Query Criteria "all values" problem

  • Thread starter Thread starter Adam Alexander
  • Start date Start date
A

Adam Alexander

I am running a select query that has a user inputed
criteria. I need to know what I can enter as a parameter
so there are no criteria on this select query.

To illistrate the problem, imagine I have a field
called "names". I have multiple records with John as a
name, same for henry and sam. The query asks "What name do
you want?" and if the user types in henry, all the henry
records are selected. I want to know what to enter so all
henrys, sams and Johns are selected.

Can anyone help me please?

Sincerely,
Adam Alexander
 
Instead of using "=" to select, if you use Like, as in
names Like [input] + "*"
then if you enter a * you will get all records, however,
if you enter sam, you will get all sam, sammy, samantha,
samuri, etc, everything starting with a "sam"
 
I am running a select query that has a user inputed
criteria. I need to know what I can enter as a parameter
so there are no criteria on this select query.

To illistrate the problem, imagine I have a field
called "names". I have multiple records with John as a
name, same for henry and sam. The query asks "What name do
you want?" and if the user types in henry, all the henry
records are selected. I want to know what to enter so all
henrys, sams and Johns are selected.

Several ways to do this. One that I like is to use a criterion

[names] = [Enter name, blank for all:] OR [Enter name, blank for all:]
IS NULL

If the user types a name, it will be matched; if they leave the prompt
empty, the IS NULL criterion will apply and pull all records.
 
Thanks, this is just what I was looking for, and I didn't even have to ask!

Steve P.


John Vinson said:
I am running a select query that has a user inputed
criteria. I need to know what I can enter as a parameter
so there are no criteria on this select query.

To illistrate the problem, imagine I have a field
called "names". I have multiple records with John as a
name, same for henry and sam. The query asks "What name do
you want?" and if the user types in henry, all the henry
records are selected. I want to know what to enter so all
henrys, sams and Johns are selected.

Several ways to do this. One that I like is to use a criterion

[names] = [Enter name, blank for all:] OR [Enter name, blank for all:]
IS NULL

If the user types a name, it will be matched; if they leave the prompt
empty, the IS NULL criterion will apply and pull all records.
 
Back
Top