Query Question

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

Guest

Hi,

I have a query which selects based on two parameters that the user choses
from two combo boxes. All good. However, I only want the second "Like"
statement to execute if the user selects and actual value from the combo box.
At the moment if I don't select a value it returns an empty set, of course.
 
I would handle using VBA code. Either create an inline SQL, or call a
different query based on the selected criteria.

--
Steve Clark, Access MVP
FMS, Inc.
www.fmsinc.com/consulting

Kiwi lost in Asia said:
Hi,

I have a query which selects based on two parameters that the user choses
from two combo boxes. All good. However, I only want the second "Like"
statement to execute if the user selects and actual value from the combo box.
At the moment if I don't select a value it returns an empty set, of
course.
 
Suggest trying something *like* that

SELECT *
FROM YourTable
WHERE ((YourFieldToFilter Like "*" & [Input2ndCombo] & "*") AND
([Input2ndCombo] Is Not Null)) OR ([Input2ndCombo]) Is Null);

I cannot post anything more detailed, ...unless you provide more details
first on your select query.

Hope being helpful

Tonín

Kiwi lost in Asia said:
Hi,

I have a query which selects based on two parameters that the user choses
from two combo boxes. All good. However, I only want the second "Like"
statement to execute if the user selects and actual value from the combo box.
At the moment if I don't select a value it returns an empty set, of
course.
 
Back
Top