Hi guys,
I have written the following code to filter based on a selection from
a dropdown box, and it works:
Private Sub txt_FilterByWhat_Change()
DoCmd.ShowAllRecords
If (Me.FilterByWhere = "") Or IsNull(Me.FilterByWhere) Then
Me.Filter = "Type ='" & Me.txt_FilterByWhat & "'"
Me.FilterOn = True
DoCmd.Requery
Else
Me.Filter = "Type ='" & Me.txt_FilterByWhat & "'" & "and Where ='" &
Me.FilterByWhere & "'"
Me.FilterOn = True
DoCmd.Requery
End If
End Sub
So I copied and pasted it, changing the fields around to produce the
following, but it doesn't work... any ideas?
Private Sub FilterByWhere_Change()
DoCmd.ShowAllRecords
If (Me.txt_FilterByWhat = "") Or IsNull(Me.txt_FilterByWhat) Then
Me.Filter = "Type ='" & Me.FilterByWhere & "'"
Me.FilterOn = True
DoCmd.Requery
Else
Me.Filter = "Type ='" & Me.txt_FilterByWhat & "'" & "and Where ='" &
Me.FilterByWhere & "'"
Me.FilterOn = True
DoCmd.Requery
End If
End Sub