View Full Version : Query By Form - Checkboxes


silver
02-03-2009, 07:26 AM
Hi Guys!

I have a form which contains multiple checkboxes and a button. On clicking the button i would like to query the information that matches the checked boxes only from a single table.

How can i do this taking into consideration the unchecked ones?

Any advice/references greatly appreciated

MSAccessRookie
02-03-2009, 11:51 AM
Hi Guys!

I have a form which contains multiple checkboxes and a button. On clicking the button i would like to query the information that matches the checked boxes only from a single table.

How can i do this taking into consideration the unchecked ones?

Any advice/references greatly appreciated


I am not sure that concern about whether a checkbox has been Selected/Unselected is even necessary for this example.

When Dealing with Checkboxes in most versions of SQL, the following is true:

An Unselected Box has a value of 0
A Selected Box has a value of NOT 0 (In most cases it is 1 or -1)
Using thes statements as rules, it becomes clear that selecting any checkbox with a non-zero value will do two things:

Get any record that has been Selected
Ignore any Record that has not been selected
See if this helps you to make your query

John Big Booty
02-03-2009, 12:26 PM
As an expansion on MSAccessRookie's comments, in the criteria of a query -1 and True are interchangeable for a checked check box whilst 0 and False are interchangeable for an unchecked check box.