DatabaseLessons.com

'Serving the Microsoft® Access
Community since 1997'

News/Blog
Tables
Queries
Forms
Reports
Modules
Miscellaneous
Subscribe
Free Samples
Videos
Services
Links
About Us

 

 

Query Parameters - Part 2

In part 1 of this article (click here to read it) we learned how an Microsoft® Access form could be used to collect criteria information for a query.

(article continues after sponsor spot)



What if we want to allow the user to enter only part of a string, or no string at all? The first version would allow for partial word criteria, the second would, in effect, create a query with no criteria.

If it is a text field, this version will do the trick:

      Like   "*"   &   [forms]![myform]![myfield]   &   "*"

If we are using combo boxes or list boxes to pick from before running the query, we have to allow for a user not picking anything. This may be, in effect, a request to list all records.

Use this style:

      [forms]![myform]![myfield]   or   [forms]![myform]![myfield] is null

This method can be used with regular text boxes as well.

Part 3 of this series is here.

Happy Coding

 
Note: This web site dedicated to MS Access database users is an independent publication of Richard W. Killey and is not affiliated with, nor has it been authorized, sponsored, or otherwise approved by Microsoft® Corporation.
 

 

© 2006, 2007, 2008 Richard W. Killey. All Rights Reserved. - Privacy Policy