or in query

  • Thread starter Thread starter DD
  • Start date Start date
D

DD

i have a query that the criteria is the [item #]. if this is typed in i
only want the results of this item #. i would also like to have the user
enter ALL to bring up all the item numbers. can this be done in the same
query.

thanks
 
This may work:

SELECT *
FROM TableName
WHERE [Item #] = [Enter the item number:]
OR "ALL" = [Enter the item number:];
 
Assuming you have a text box on a form you are entering either the item
number or ALL, this should do it:

WHERE [item #] LIKE IIF(Forms!FormName!TextBoxName) = "ALL", "*",
Forms!FormName!TextBoxName)
 
Back
Top