Cmd button open form type based on the field value (1 Viewer)

Nancythomas

Registered User.
Local time
Yesterday, 19:49
Joined
Apr 20, 2010
Messages
59
Hello Everyone

I have a search form where I enter a date range and get a list of all files within a give date.

I have created a cmd button to open form1 or form2 based on the information / data in the above row (results)

I would like the system to do the following:

Private Sub cmdSrchAVLOG_Click()

If Field1.Value = "Availability" Then
''DoCmd.OpenForm "Form1"

If Field2.Value = "NOT Availability" Then
''DoCmd.OpenForm "FORM2"

End If
End Sub

This does not work. Can you please help
 

JHB

Have been here a while
Local time
Today, 04:49
Joined
Jun 17, 2012
Messages
7,732
You've a quotes before the DoCmd, (remove it)!
Code:
[B][COLOR=Red]''[/COLOR][/B]DoCmd.OpenForm "Form1"
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 19:49
Joined
Aug 30, 2003
Messages
36,127
You also have two If statements but only one End If, so the code won't compile.
 

Users who are viewing this thread

Top Bottom