Filtering data using a list box as criteria in my SQL statement

  • Thread starter Thread starter JB63
  • Start date Start date
J

JB63

When I use a list box as criteria in the sql statement to filter data I would
like to return all data if the box is left blank, any Ideas?
 
I use multiple list boxes in a form to display data in a subform on the form,
I sort this data using criteria in the subform's SQL ,"ex. EquipmentID
(criteria) [Forms]![LogSearch]![EquipmentID] and ShiftID (criteria)
[Forms]![LogSearch]![ShiftID]" I would like the form to display all of the
logs when the list box is left blank.
Thanks for the reply i am new to this forum.
 
Can't help without the SQL you referenced in your original post. Sorry, but
your most recent post only added to the confusion

JB63 said:
I use multiple list boxes in a form to display data in a subform on the
form,
I sort this data using criteria in the subform's SQL ,"ex. EquipmentID
(criteria) [Forms]![LogSearch]![EquipmentID] and ShiftID (criteria)
[Forms]![LogSearch]![ShiftID]" I would like the form to display all of the
logs when the list box is left blank.
Thanks for the reply i am new to this forum.

Klatuu said:
Post the SQL so we can see what it looks like now, please.
 
When I use a list box as criteria in the sql statement to filter data I would
like to return all data if the box is left blank, any Ideas?

= [Forms]![YourForm]![YourListtbox] OR [Forms]![YourForm]![YourListbox] IS
NULL

This will only work for a single-select listbox, though; if you are using a
multiselect listbox you'll need some code.
 
John W. Vinson said:
When I use a list box as criteria in the sql statement to filter data I would
like to return all data if the box is left blank, any Ideas?

= [Forms]![YourForm]![YourListtbox] OR [Forms]![YourForm]![YourListbox] IS
NULL

This will only work for a single-select listbox, though; if you are using a
multiselect listbox you'll need some code.
 

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