Adding "All" as an option to a query list for criteria on a report

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

Guest

I have a form that users access to designate criteria for a report based on a
query. How would I go about adding an "All" option to the listboxes for
criteria? The wildcards "*", "?" don't seem to be working...if you need more
information please let me know. Thanks!
 
You'll need a union query for the listbox's rowsource. Something like:

Select "<All>" As MyField1, "" As MyField2 FROM MyTable
UNION
Select MyField1, MyField2 FROM MyTable;

Then in the event handler for the listbox, you'll need to specifically look
for a selection of "<All>" and decide how to handle it.

Barry
 
Thanks!

Barry Gilbert said:
You'll need a union query for the listbox's rowsource. Something like:

Select "<All>" As MyField1, "" As MyField2 FROM MyTable
UNION
Select MyField1, MyField2 FROM MyTable;

Then in the event handler for the listbox, you'll need to specifically look
for a selection of "<All>" and decide how to handle it.

Barry
 
Another way is like this --

Like IIf([Forms]![YourForm]![YourListBox] Is Not
Null,[Forms]![YourForm]![YourListBox],"*")
 
We do need more information.

If you are using WHERE [field]= [param] and can use WHERE [field] LIKE
[param] instead then you can modify that to WHERE [field] LIKE IIF
([param]="All","*",[param])
 
Back
Top