Thread: If, Then, Else
View Single Post
  #1  
Old November 5th, 2009, 07:27 PM posted to microsoft.public.access.forms
ann
external usenet poster
 
Posts: 462
Default If, Then, Else

Hi,

I'm a bit confused and hope someone can help. I'm just learning code and
can't figure out why I keep getting an compile error; Else Without If on the
following code. Thanks in advance.

Private Sub Command930_Click()
On Error GoTo Err_Command930_Click

Dim stDocName As String
Dim stLinkCriteria As String

If SSN.Value = -1 And ysnName.Value = -1 _
And Recipient_of_PHI = "Entity" Or Recipient_of_PHI = "Person" Then _
stDocName = "frmAction1-5"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
stDocName = "frmAction5"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

Exit_Command930_Click:
Exit Sub

Err_Command930_Click:
MsgBox Err.Description
Resume Exit_Command930_Click

End Sub