troubleshooting Question

Creating multiple form controls to filter records in a subform...

Avatar of KP_SoCal
KP_SoCalFlag for United States of America asked on
DatabasesMicrosoft AccessVBA
10 Comments1 Solution62 ViewsLast Modified:
For simplicity's sake, in my Access 2010 database form that contains a subform, let's say I have three check box controls (I actually have much more than three) that I'm using to filter records in an embedded subform.

screenprint
As you can see from my code below, when Me.chkBoxFilter1 is checked, only records for fldFilter1= True are displayed. When unchecked, all records are displayed.

If IsNull(Me.chkBoxFilter1) Then
   Me.subformColorSurrogation.Form.Filter = ""
   Me.subformColorSurrogation.Form.FilterOn = False

Else
  Me.subformColorSurrogation.Form.Filter = "[fldFilter1]=" & Me.chkBoxFilter1
  Me.subformColorSurrogation.Form.FilterOn = True
End If

I'm looking for a way I can add or remove other filters through the use of my other check boxes. I know I could accomplish this through multiple ELSEIF statements, but is there a way, for instance, when clicking M.chkBoxFilter2 to TRUE, to ONLY pull TRUE records for fldFilter2 without unfiltering the restrictions placed by my other checkboxes?

I hope this makes sense. I really appreciate any insight into this.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros