Access 97 - Code for multiple filters in a form from its combos.
Posted on 2005-03-10
Hallo, here is my problem. I have a form taking data from a query and 3 combos in it, taking lists elsewhere.
I would like to write a code, applicable to each Combo after their update, the allows the form to view the data of the query applying 3 filter together.
I wrote this:
Private Sub ComboX_AfterUpdate()
Dim Filter1 As String
Dim Filter2 As String
Dim Filter3 As String
Dim Filter As String
Filter1 = IIf(Combo1 = "All", "*", " & Field1 & ")
Filter2 = IIf(Combo2 = "All", "*", " & Field2 & ")
Filter3 = IIf(Combo3 = "All", "*", " & Field3 & ")
Filter = [Field1] = Filter1 And [Field2] = Filter2 And [Field3] = Filter3
Me.Filter = Filter
Me.FilterOn = True
Unnfortunately, it does not work: could you help me featuring this? Thanx.