Hi guys,
I have written the following code to filter based on a selection from
a dropdown box, and it works:
Private Sub txt_FilterByWha t_Change()
DoCmd.ShowAllRe cords
If (Me.FilterByWhe re = "") Or IsNull(Me.Filte rByWhere) Then
Me.Filter = "Type ='" & Me.txt_FilterBy What & "'"
Me.FilterOn = True
DoCmd.Requery
Else
Me.Filter = "Type ='" & Me.txt_FilterBy What & "'" & "and Where ='" &
Me.FilterByWher e & "'"
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_C hange()
DoCmd.ShowAllRe cords
If (Me.txt_FilterB yWhat = "") Or IsNull(Me.txt_F ilterByWhat) Then
Me.Filter = "Type ='" & Me.FilterByWher e & "'"
Me.FilterOn = True
DoCmd.Requery
Else
Me.Filter = "Type ='" & Me.txt_FilterBy What & "'" & "and Where ='" &
Me.FilterByWher e & "'"
Me.FilterOn = True
DoCmd.Requery
End If
End Sub
I have written the following code to filter based on a selection from
a dropdown box, and it works:
Private Sub txt_FilterByWha t_Change()
DoCmd.ShowAllRe cords
If (Me.FilterByWhe re = "") Or IsNull(Me.Filte rByWhere) Then
Me.Filter = "Type ='" & Me.txt_FilterBy What & "'"
Me.FilterOn = True
DoCmd.Requery
Else
Me.Filter = "Type ='" & Me.txt_FilterBy What & "'" & "and Where ='" &
Me.FilterByWher e & "'"
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_C hange()
DoCmd.ShowAllRe cords
If (Me.txt_FilterB yWhat = "") Or IsNull(Me.txt_F ilterByWhat) Then
Me.Filter = "Type ='" & Me.FilterByWher e & "'"
Me.FilterOn = True
DoCmd.Requery
Else
Me.Filter = "Type ='" & Me.txt_FilterBy What & "'" & "and Where ='" &
Me.FilterByWher e & "'"
Me.FilterOn = True
DoCmd.Requery
End If
End Sub
Comment