How to add "All" to a combo box

G

Guest

1) I have created a form with an unbound combo box in order to control data
on a report. The form also incudes date range fields to further restrict
data. The form works well when I select a category from the combo box and
enter dates, however, I am trying to get "All" to be included in the combo
box so that when "All" is selected; all records will be reported...

2) I would also like to have an option to turn off the date fields so that
the report shows any/all records irrespective of dates...

Any hints?
 
D

Douglas J. Steele

Check http://www.mvps.org/access/forms/frm0043.htm at "The Access Web" for
one way to add All to a combo box.

Assuming that your query is based on the combo box, you have to do a little
bit of work to get it to use the All. One option is where you've currently
got

WHERE MyField = Forms!MyForm!MyCombobox

you can use WHERE

WHERE (MyField = Forms!MyForm!MyCombobox OR Forms!MyForm!MyCombobox =
"All")

Similarly, assuming the date range comes from values on your form, you check
whether the table field equals the value in the form's control OR the form's
control IS NULL.
 

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

Similar Threads


Top