I have created a form that contain two combo boxes and two cmd buttons. The idea of the form is that the user will select a search parameter from each combo box then will click the first cmd button "cmdCreateRepor t". Upon doing so it open a report based of the search criteria.
My problems seems to lay with the seconf cmd button :
cmdRemoveFilter
also here is te code i used for cmdCreateReport
So here is the issue:
I open the form and select my parameters and click on cmdCreateReport and it opens the report correctly. I then click the cmdRemoveFilter button and the report then will show all search parameters possable. I assumed that if I were to then go back and change the search parameters in the form and click cmdCreateReport a second time it would then excute properaly but instead the report stays as it was. So how do I make it where I can keep changing the filter processand make the report to produce the search each time?
My problems seems to lay with the seconf cmd button :
cmdRemoveFilter
Code:
Private Sub cmdRemoveFilter_Click()
On Error Resume Next
' Switch the filter off
Reports![tblContacts].FilterOn = False
End Sub
Code:
strWhere = "1=1 " If Not IsNull(Me.cboModel) Then strWhere = strWhere & " AND [ModelName] =""" & Me.cboModel & """ " End If If Not IsNull(Me.cboLocationCode) Then strWhere = strWhere & " AND [LocationCode] =""" & Me.cboLocationCode & """ " End If DoCmd.OpenReport "tblContacts", acPreview, , strWhere End Sub
I open the form and select my parameters and click on cmdCreateReport and it opens the report correctly. I then click the cmdRemoveFilter button and the report then will show all search parameters possable. I assumed that if I were to then go back and change the search parameters in the form and click cmdCreateReport a second time it would then excute properaly but instead the report stays as it was. So how do I make it where I can keep changing the filter processand make the report to produce the search each time?
Comment