Multiple Criteria for Query

E

Eric

This is probably an easy question for everyone but me. I
have a user form that allows input for criteria in a
parameter query. There are 5 fields on the form. I can't
seem to figure out the code to put in the query for each
field that would tell the program to look in a specific
textbox for criteria and if the box is blank, ignore that
box and move to the next.

Ex.
Text 1=Smith
Text 2="Blank"
Text 3="Blank"
Text 4=555-1212
Text 5="Blank"

If there is a value in the Textbox, I want it to look in
the corresponding database field for that value. If the
Textbox is blank, I want it to skip that box. I use this
form to look up missing information for customers and to
update records. Right now, if I leave a field blank, it
returns nothing. Anyone have any ideas on this?

Thanks a million!
 
C

Chris Large

Hi

For each field in the query put the following in the
criteria:-

[Forms]![YourForm]![YourTextBox] OR [Forms]![YourForm]!
[YourTextBox] is null

hth

Chris
 
B

Bob

In the query design add something like this for each text
box control:

=Forms![myForm]![text1] OR Forms![myForm]![text1] 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