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

How to pass a parameter with or without a value?

Status
Not open for further replies.

Apollo6

Technical User
Jan 27, 2000
418
US
I am trying to query a table where the user is prompted to enter a location code. If they don't put in a location code, the query should return all locations, else, return the location they entered.

What would be the syntax in the criteria line of the query to get the above results? Lets say the location code field name is loc_code...

I've tried-

[Enter location code:] Or Nz([loc_code],"")

This criteria gives me back all locations if I don't put any location code in but still gives me all locations if I put in a specific location code.

Any suggestions would be appreciated.
 
Have you tried this ?
[Enter location code:] Or IsNull([Enter location code:])


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for the follow-up...

Your suggestions looks like it will work. I managed to figure it out by doing this...

[Enter location code:] Or [Enter location code:] Is Null

I believe yours and mine are the same.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top