Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Newbie Needs Help Filtering MSAccess Form
I apologize in advance for my knowledge base. I am decent at developing databases using all of the canned features and query tools in Access. I am trying to learn VBA.
I am trying to filter 2 fields using as input the selections in a drop down combo box and an option box.
I have a combo box [CustomerSelect] that filters a customer name. (which by the way I don't completely understand the ampersand usage. another topic)
Me.Filter = "CUS_CorpName = """ & Me.CustomerSelect & """"
That works fine. Now I am trying to filter that further with my option box.
I have an option box [WOStatus] to select "Released" or "Complete" work orders using the values 1 or 2. The field I am trying to filter is [WKO_StatusCode]
If Me.WOStatus = "2" Then
Me.Filter = "WKO_StatusCode= 'Complete'"
Me.FilterOn = True
Can you help me with the correct syntax to filter both fields in one statement?
Inexperience and confused.
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
That worked. Thanks for your help.
Can you explain when I should use of the ampersand? Can't seem to get a handle on that.
<Can you explain when I should use of the ampersand? Can't seem to get a handle on that. >
Not an easy answer here...
The Ampersand is the "Concatenation" character in VBA.
So anytime you want to "Join" two expressions, you would use the ampersand.
The Kicker is that you need to remember that most of the time you need a space bar character between the expressions...
Expression1 & " " & Expression2
(When to use Single and Double quotes is a whole other subject...)
In your case since you were needing two Filters, you also needed the word "And" concatenated in as well.
FilterOne & " And " & FilterTwo
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
Thanks. As odd as it is, I actually understand. That's scary.
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent