Hi, I have this code which is working perfectly:
Private Sub cmdbutton1_Click()
Dim sWHERE As String
sWHERE = "[MyQuery].[MyField] = '" & Me.cboField & "'"
'Open the form
DoCmd.OpenForm "MyForm", acNormal, , sWHERE
End Sub
I got this basic syntax on-line, however, I want to add an AND clause, and just don't understand the use of " or ' and so I can't get it working. I've tried a number of different variations. Basically I want to have something like this:
Private Sub cmdbutton1_Click()
Dim sWHERE As String
sWHERE = "[MyQuery].[MyField1] = '" & Me.cboField1 & "'"
AND "[MyQuery].[MyField2] = '" & Me.cboField2 & "'"
'Open the form
DoCmd.OpenForm "MyForm", acNormal, , sWHERE
End Sub
Any help would be appreciated.
Thanks,
Kirsti