and query urgent help

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

Guest

i need to do and query which take its parameters from text box. if one of the
text box is empty the query show show all the options.

example:
text1, text 2
1) the criteria is text1 and text 2
2) if text1 is empty only text2 tale in considuration and the other way
arround
how can i do this kind of query
 
WHERE ([Field1] = text1 AND [Field2] = text2) OR ([Field1] = text1 AND text2
IS NULL) OR (text1 IS NULL AND [Field2] = text2)

If the text boxes may contain empty strings, you may need to modify the
tests from e.g. text1 IS NULL to e.g. text1 & "" = ""
 
Back
Top