passing empty criteria fields?

  • Thread starter Thread starter _Bigred
  • Start date Start date
B

_Bigred

Access 2000

Is there a way for me to set a query and base a report on it which will
allow the following:

Prompt for
Last Name
First Name
Year

If I don't enter 1 of the criterion, it will return the values found using
the other criteria?

EG.
Last Name - Type in Doe
First Name - * leave blank *
Year - 2005
- And have it return all records that are for ANY Does in 2005 in the
database.

TIA,
_Bigred
 
Access 2000

Is there a way for me to set a query and base a report on it which will
allow the following:

Prompt for
Last Name
First Name
Year

If I don't enter 1 of the criterion, it will return the values found using
the other criteria?

EG.
Last Name - Type in Doe
First Name - * leave blank *
Year - 2005
- And have it return all records that are for ANY Does in 2005 in the
database.

Use a criterion of

= [Enter last name:] OR [Enter last name:] IS NULL

on the LastName field, and similarly for the other fields.

John W. Vinson[MVP]
 
Hello John,

Using the
OR Is Null works on the [Enter Last Name] criteria.
The first name is Like[Enter First Name]&"*" do I have to do this
differently, because it doesn't seem to work with it as the criteria on this
field.?

TIA,
_Bigred


John Vinson said:
Access 2000

Is there a way for me to set a query and base a report on it which will
allow the following:

Prompt for
Last Name
First Name
Year

If I don't enter 1 of the criterion, it will return the values found using
the other criteria?

EG.
Last Name - Type in Doe
First Name - * leave blank *
Year - 2005
- And have it return all records that are for ANY Does in 2005 in the
database.

Use a criterion of

= [Enter last name:] OR [Enter last name:] IS NULL

on the LastName field, and similarly for the other fields.

John W. Vinson[MVP]
 
Hello John,

Using the
OR Is Null works on the [Enter Last Name] criteria.
The first name is Like[Enter First Name]&"*" do I have to do this
differently, because it doesn't seem to work with it as the criteria on this
field.?

If you're using LIKE [Enter first name:] & "*" then you don't need to
do anything else - if the user enters nothing, the criterion will be

LIKE "*"

and it will return all records anyway.

John W. Vinson[MVP]
 
Well thanks John, I appreciate the time and attention.

Take Care,
_Bigred


John Vinson said:
Hello John,

Using the
OR Is Null works on the [Enter Last Name] criteria.
The first name is Like[Enter First Name]&"*" do I have to do this
differently, because it doesn't seem to work with it as the criteria on
this
field.?

If you're using LIKE [Enter first name:] & "*" then you don't need to
do anything else - if the user enters nothing, the criterion will be

LIKE "*"

and it will return all records anyway.

John W. Vinson[MVP]
 
Back
Top