multiple query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do i search multiple fields (LNAME, FNAME, TYPE) and put the results in a
subform in my main form while being able to leave fields that are not
applicable blank and still receive results for the fields that have value
entered. Any help is greatly appreciated.

Thanks
-Alfred
 
To prompt a user for a parameter and allow it to be left blank for all,
you'd do something like this...


Like [Enter Customer Name] & "*"

This also allows them to enter a partial name. What it does is adds the
asterisk onto whatever they type and Access treats that as a wildcard. If
they enter "SMITH" Access will look for "SMITH*" which would find SMITH,
SMITHERS, SMITHSON, etc. If they enter nothing, Access will llok for "*"
which would find everything.

To allow searches anywhere in the string, you could put...
Like "*" & [Enter Customer Name] & "*"


You could also refer to a field on a form and concantenate the "*" to it in
case the user leaves the field blank.

Hope that helps.
Rick B
 
Great thanks alot. One additional question, when i am put in the Like [Enter
Customer Name] & "*" i am putting it as a criteria on the same line across
the different field(s) like (FNAME, LNAME, TYPE) but when i run the query it
gives me nothing. Am i doing something wrong?


Rick B said:
To prompt a user for a parameter and allow it to be left blank for all,
you'd do something like this...


Like [Enter Customer Name] & "*"

This also allows them to enter a partial name. What it does is adds the
asterisk onto whatever they type and Access treats that as a wildcard. If
they enter "SMITH" Access will look for "SMITH*" which would find SMITH,
SMITHERS, SMITHSON, etc. If they enter nothing, Access will llok for "*"
which would find everything.

To allow searches anywhere in the string, you could put...
Like "*" & [Enter Customer Name] & "*"


You could also refer to a field on a form and concantenate the "*" to it in
case the user leaves the field blank.

Hope that helps.
Rick B



Alfred FPC said:
How do i search multiple fields (LNAME, FNAME, TYPE) and put the results in a
subform in my main form while being able to leave fields that are not
applicable blank and still receive results for the fields that have value
entered. Any help is greatly appreciated.

Thanks
-Alfred
 
Back
Top