selecting criteria from listbox

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

Guest

i have seen several posts that relate to this question, but none that answers
my problem directly, so sorry if this sounds repetitive! anyway, what i have
is a query who's criteria are based on values in several listboxes. query
results are then output to textboxes on same form, after a requery macro. my
form works fine when a specific criteria is selected from each listbox, but i
would also like to output using NO criteria from one or all textboxes (i.e.
ALL records). my efforts include adding a Like "*" record to the listbox,
etc., but to no avail. any help would be appreciated! Thanks!
 
i have seen several posts that relate to this question, but none that answers
my problem directly, so sorry if this sounds repetitive! anyway, what i have
is a query who's criteria are based on values in several listboxes. query
results are then output to textboxes on same form, after a requery macro. my
form works fine when a specific criteria is selected from each listbox, but i
would also like to output using NO criteria from one or all textboxes (i.e.
ALL records). my efforts include adding a Like "*" record to the listbox,
etc., but to no avail. any help would be appreciated! Thanks!

If "several" is less then eight or ten or so (the query gets pretty
complex if you go higher), you can use criteria such as

= [Forms]![formname]![listbox] OR [Forms]![formname]![listbox] IS NULL

If you do run into problems, and alternative is to put VBA code on the
form to poll through the listboxes, building a SQL WHERE clause for
each that is not null.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top