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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter query returns all rows if left blank

Status
Not open for further replies.

elizabeth

IS-IT--Management
Sep 16, 1999
1,196
US
Just saw this tip that easily solves a common problem:<br><br>1. To write a parameter query that returns one specified value OR <b>all</b> values when the user leaves the input blank, put a statement like this in the criteria row of the appropriate column:<br><i>(Like [Enter a city or leave blank for all cities]) Or Like [Enter a city or leave blank for all cities] Is Null</i><br><br>2. To allow the user to input a leading string OR leave the input blank, do it this way:<br><i>(Like [Enter first letter(s) of a city or leave blank for all cities] & &quot;*&quot;) Or Like [Enter a city or leave blank for all cities] Is Null</i><br><br>The key is what's inside the first and second set of brackets must be <i>exactly</i> the same or it will ask for input twice.<br>
 
I usually do something like this:<br><br>Like [Enter the name, initial or leave blank for all]&*<br>or <br>Like *&[Enter the name, part of the name or leave blank for all]&*<br><br><br>This will allow a perfect name, a couple letters or first initial or any part of name or all of the records.
 
This is really great. But I have a further question: how do you do this if your parameter has a range? In other words, a beginning and ending date. By following the same pattern for the criteria, I could not get all of the dates to appears when pressing enter twice. [sig]<p>Laura Velez<br><a href=mailto:lauravelez@home.com>lauravelez@home.com</a><br><a href= > </a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top