Hi everybody!
I am currently building multiple dynamic filters for a split form and actually everything is working how I want it to work. What I don't like
is how unneccesarily complicated my solution probably is.
So the idea is that you simply use the text fields in the header row to filter the data in the table. The problem I came across is that no matter how
you apply a filter using VBA (DoCmd.ApplyFilter or Me.Filter), you automatically remove all active filters. This is very unfortunate when I want multiple filters to be active.
So here is what I have done to solve this problem for the "City" text control:
And this code works for me. The thing is that this code assumes that all 3 text controls (ignoring City) have a value in them. So I also have to write the same code to take into account that maybe only 2 of the 4 text controls carry a value, and so on...FirstName = Me.Text121.Value
LastName = Me.Text123.Value
Gender = Me.Text133.Value
City = Me.Text136.Value
If FirstName <> "" And FirstName <> "First Name Here" And LastName <> "" And LastName <> "Last Name Here" And Gender <> "" And Gender <> "Gender Here" Then
DoCmd.SetFilter
DoCmd.ApplyFilter , "[Gender] = '" & Gender & "' And [City] = '" & City & "' And [First Name] = '" & FirstName & "' And [Last Name] = '" & LastName & "'"
GoTo Sel
End If
So what it all comes down to me is the following question: Isn't there a command to apply a filter that doesn't remove all other active filters? Would make my life much easier!