Multiple parameter query

M

Michael

Hi,

I'm trying to create a query with multiple parameters. There are three
fields that can be used to identify any record in the table: file, revision,
extension. The file name has to match what the user enters into the pop-up
dialog box, but the revision and extension fields may be null. For example,
you may have: File 1 with both the revision and extension fields null. You
may also have File 1, Revision 1, with the extension field null, and so on.

In the Query Design Grid, I entered under criteria for the File field: [File
Number?] Then on the same criteria line, I entered [Revision?] for the
Revision field, etc. This query seems to work when there is a value other
than null for all three fields. However, if the value is null and the person
leaves the pop-up box blank for that particular field, the query returns no
records. Essentially, the file number must match what the user enters in the
pop-up box and the other fields must match too, but in many instances, the
other fields are null.

How can I revise this query so that if the user enters 1 in the File Number
pop-up box, nothing in the Revision pop-up box, and 2 in the Extension pop-up
box, the query will return that record?

Thank you so much for any help you can provide.

Michael
 
M

Marshall Barton

Michael said:
I'm trying to create a query with multiple parameters. There are three
fields that can be used to identify any record in the table: file, revision,
extension. The file name has to match what the user enters into the pop-up
dialog box, but the revision and extension fields may be null. For example,
you may have: File 1 with both the revision and extension fields null. You
may also have File 1, Revision 1, with the extension field null, and so on.

In the Query Design Grid, I entered under criteria for the File field: [File
Number?] Then on the same criteria line, I entered [Revision?] for the
Revision field, etc. This query seems to work when there is a value other
than null for all three fields. However, if the value is null and the person
leaves the pop-up box blank for that particular field, the query returns no
records. Essentially, the file number must match what the user enters in the
pop-up box and the other fields must match too, but in many instances, the
other fields are null.

How can I revise this query so that if the user enters 1 in the File Number
pop-up box, nothing in the Revision pop-up box, and 2 in the Extension pop-up
box, the query will return that record?


Try this kind of criteria for the Revision and Extension
fields:

=[Revision?] Or [Revision?] Is Null
 
M

Michael

Thanks, Marsh. That solved the problem.

Marshall Barton said:
Michael said:
I'm trying to create a query with multiple parameters. There are three
fields that can be used to identify any record in the table: file, revision,
extension. The file name has to match what the user enters into the pop-up
dialog box, but the revision and extension fields may be null. For example,
you may have: File 1 with both the revision and extension fields null. You
may also have File 1, Revision 1, with the extension field null, and so on.

In the Query Design Grid, I entered under criteria for the File field: [File
Number?] Then on the same criteria line, I entered [Revision?] for the
Revision field, etc. This query seems to work when there is a value other
than null for all three fields. However, if the value is null and the person
leaves the pop-up box blank for that particular field, the query returns no
records. Essentially, the file number must match what the user enters in the
pop-up box and the other fields must match too, but in many instances, the
other fields are null.

How can I revise this query so that if the user enters 1 in the File Number
pop-up box, nothing in the Revision pop-up box, and 2 in the Extension pop-up
box, the query will return that record?


Try this kind of criteria for the Revision and Extension
fields:

=[Revision?] Or [Revision?] Is Null
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top