I have a continuous form which I filter the results by selections through 2 combo boxes and clicking a button in the header portion of the form. My code on the button is as follows:
Private Sub Command17_Click()
Dim mySearch As String
mySearch = "Select * from qMarconL where (([City] = '" & Me.Combo1 & "') AND ([LastName] = '" & Me.Combo2 & "')) "
Me.qMarconLsubform.Form.RecordSource = mySearch
Me.qMarconLsubform.Form.Requery
End Sub
I get the correct results in the subform in the details section of the continuous form when both combo boxes are filled out but don't get any records if only one combo box is filled out.
I would like to be able to fill out one combo box and get results. How can I get results if only one combo box is filled out? I would also like to get results of all records if neither of the combo boxes are filled out.
Private Sub Command17_Click()
Dim mySearch As String
mySearch = "Select * from qMarconL where (([City] = '" & Me.Combo1 & "') AND ([LastName] = '" & Me.Combo2 & "')) "
Me.qMarconLsubform.Form.RecordSource = mySearch
Me.qMarconLsubform.Form.Requery
End Sub
I get the correct results in the subform in the details section of the continuous form when both combo boxes are filled out but don't get any records if only one combo box is filled out.
I would like to be able to fill out one combo box and get results. How can I get results if only one combo box is filled out? I would also like to get results of all records if neither of the combo boxes are filled out.