How do I use checkboxes in an Access form to get query results?

R

Rookie7777

This is the deal: I have data from three different states that I need to
retrieve using a form. I have created checkboxes on the form, to allow my
users to select which states they want displayed when the query runs. How do
I:
a) Get the query to understand what is being checked? i.e. how do I get the
query to display "California" when the California checkbox is checked by the
user
b) How do I get the query to understand when only one, two or three
checkboxes are checked? In other words, if Arizona and California are
displayed, only these states appear; if Washington and AZ are the only ones
checked, only they appear; and so on.
c) How do I create a checkbox that when checked, tells the query to show all
three states?

I have very basic knowlwedge of Access, but I understand what a Name is in
the property tab of an object, I know what the "Criteria" field is in a query.

Thanks in advance for your help.
 
A

AndyB via AccessMonster.com

Hi,

I'm presuming the State is one of the fields in your query, in which case, in
three criteria cells for that field enter criteria similar to:

"Arizona" And Forms![Your Form]![Arizona Checkbox] = True
"California" And Forms![Your Form]![Arizona Checkbox] = True
"Washington" And Forms![Your Form]![Arizona Checkbox] = True

The form has to remain open for the query to read the criteria, and a report
preview tends to appear behind the form, so if you need to preview the report,
use your command button which opens the report to set the Visible property of
the form to False.

You can then use the 'On Close' property of the report to set the form
visible again.

Andy
 

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

Top