Setting Query Criteria Parameters

N

Not an expert

Can someone please tell me if I set a parameter, but decide to pull all the
data in that field, what do I type in when I get the prompt after running the
query?
 
D

Dirk Goldgar

Not an expert said:
Can someone please tell me if I set a parameter, but decide to pull
all the data in that field, what do I type in when I get the prompt
after running the query?

You have to write the query to allow for the possibility. For example,
instead of

SELECT * FROM MyTable
WHERE ID = [Enter ID];

write

SELECT * FROM MyTable
WHERE ID = [Enter ID]
OR [Enter ID] Is Null;

If you're doing wildcard matching on a text field, you can use something
like this instead:

SELECT * FROM MyTable
WHERE LastName Like [Enter start of last name] & '*';

or

SELECT * FROM MyTable
WHERE LastName Like '*' & [Enter part of last name] & '*';
 
R

Rick B

I would leave it blank.

Change your query to...

Like [EnterYourParameter] & "*"


That will let them enter the paramater (or a partial parameter) or blank.

Entering "SMI" would find "SMITH" or "SMITHSON", etc. Leaving it blank
would find all.
 
Top