I have a multiselect listbox with the following values:
*
Pacific
Texas
Northeast
Southeast
Those are divisions. I'm running a query which brings back values based on what is selected in the listbox. In my VBA code, I cycle through the selected listbox rows and build an IN statement. Example: if Pacific and Texas are selected:
Select field from table where Division in ('Pacific', 'Texas').
This works fine. SQL returns correct values. However, if the user selects the *, I want the query to return all values. The SQL then becomes:
Select field from table where Division in ('*'). That obviously doesn't work. Is there someway I can use a LIKE statement combined with the IN statement.
The other way (which I'd prefer not to do) is to code the listbox to highlight all the rows whenever the * row is selected.
Any suggestions
*
Pacific
Texas
Northeast
Southeast
Those are divisions. I'm running a query which brings back values based on what is selected in the listbox. In my VBA code, I cycle through the selected listbox rows and build an IN statement. Example: if Pacific and Texas are selected:
Select field from table where Division in ('Pacific', 'Texas').
This works fine. SQL returns correct values. However, if the user selects the *, I want the query to return all values. The SQL then becomes:
Select field from table where Division in ('*'). That obviously doesn't work. Is there someway I can use a LIKE statement combined with the IN statement.
The other way (which I'd prefer not to do) is to code the listbox to highlight all the rows whenever the * row is selected.
Any suggestions