Double filter from combo's

cos

Registered User.
Local time
Today, 18:52
Joined
Jul 13, 2012
Messages
81
hi fellers,

how do i set a double filter? i have two combo boxes with a selection of record details, so that when u select an option in the first combo box, the form filters; when u select an option in the second combo box, i want it to filter with two criteria's now..

however if one of them is blank, i want the other to still do its filter!

any ideas? =/

the screeny below is what i tried to acomplish..
and this was the other idea:
Code:
Private Sub Command87_Click()

Me.Combo35 = ""

If IsNull([Combo82]) Then
Else

DoCmd.SetFilter "", "[ShV_Manager]=[Forms]![01_VisitsList]![Combo82]", ""
       
End If
End Sub

Private Sub Command88_Click()

Me.Combo82 = ""

If IsNull([Combo35]) Then
Else

DoCmd.SetFilter "", "[Sh_Name]=[Forms]![01_VisitsList]![Combo35]", ""
       
End If

End Sub
where i had two cancel buttons next to each combo..

i think im going in circles..
 

Attachments

  • attempt 1.jpg
    attempt 1.jpg
    97.3 KB · Views: 139
The Filter method also returns a string so concatenate the current filter to the new filter. E.g.:
Code:
Me.Filter = Me.Filter & " AND [ID] = " & Me.Combobox2.Value
Me.FilterOn = True
And yes, you should be using the form's Filter method instead.

In addition you need to check if a filter already exist before attempting to concatenate.
 

Users who are viewing this thread

Back
Top Bottom