Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ApplyFilter for multiple fields 1

Status
Not open for further replies.

kgerlitz

Technical User
Oct 2, 2004
84
US
I actually have 2 questions that apply to the same issue.

1. Within the "status" field of the following code I need to apply a filter that will included multiple criteria like "inactive" and "active"

DoCmd.ApplyFilter , "status = 'inactive'"

2. I also need to apply a filter that will allow me to pull up records based on criteria from 3 different fields--same as above but using filter criteria from the "status", "budget", and "color" fields.

Thank you in advance for your help
 
1. DoCmd.ApplyFilter , "status = 'inactive' or Status ='Active'"
or try:
DoCmd.ApplyFilter , "status IN('inactive','Active')"
2. DoCmd.ApplyFilter , "status IN('inactive','Active') AND Budget=1 AND Color='red'"




Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thanks for your help--worked great.

Now that I have applied the filter I need to sort (order) but not by one of the fields that I used in the filter. Any suggestions?

I am trying to learn by using the Access help feature and a Sybex book. Do you have any recommendations for novice users?

Thanks again.
 
Are you applying the filter on a form or report? I ask because applying a sort order is different from forms to reports.

To get started, I recommend some web pages:
Using News Groups
See my signature below

General Tips

Normalization (if you don't get the structure right, everything is wrong)


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
I prefer to set the form's record source property to a newly constructed SQL statement that contains the filtering and order by. However, you should be able to use code like:
Me.OrderBy = "YourFieldName"
Me.OrderByOn = True


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top