Returning all results

betheball

Registered User.
Local time
Today, 22:35
Joined
Feb 5, 2003
Messages
107
I have a query that returns results where department matches the department entered by the user. Is there a way to use the same query to return all results. In other words, when the user is prompted to enter their department (a numeric value), is there something they can enter that will cause the query to return all results? I have tried various wildcards with no luck.
 
Hi!

In criteria where you ask for department type:

Like [Enter Department]

This way when he prompts you, you can type * and this way youll get all the results.

Cheers!
Marko
 
Thanks Marco. I always wondered why people used "LIKE". So if I understand you correctly, one must use "LIKE" to be able to use wildcards. They don't work with "=", right?
 
I would NOT use like in this way. Like should only be used if you need to support wildcard searches. "All", isn't a wildcard search. Keep in mind that queries that use "like" can NEVER be optomized and so Access can't use any indexes, it needs to resort to the brute force method of reading EVERY record in the table to respond to the query. A better method to support "all" is to use a compound condition.

Where YourDpt = [Enter Department] Or IsNull([Enter Department])
 

Users who are viewing this thread

Back
Top Bottom