- database solutions and downloads for microsoft access

Triple State Checkbox Property

Microsoft Access Checkboxes and using the Triple State Property

When creating a database there may be occasions where you may wish to include a checkbox (a Yes/No field datatype) to allow the user to answer either yes or no to the field in question.

Obvious example of using a checkbox would be when creating a questionnaire and you are expecting the user to answer the question with only one of two answers. Other times you may wish to include the field, in say a membership type database, to say whether a member was active or not, whether a member had paid their membership or whether the member was attending the next event or not.

If we take an example of whether the member was attending the next event and you as the designer had sent out an e-mail to ask whether or not they would be coming. The member would reply either Yes, therefore you would check the checkbox to indicate Yes, or the member may respond and say No, therefore you would not check the checkbox.

What if the member did not respond the the request?

Would you then check or leave the checkbox not checked?

This shows how you would use the TripleState property of the checkbox in a form. The checkbox can have 3 values rather than the common two.

A normal check box can have only values of 0 (unchecked) or -1 (checked) corresponding to Yes/No or True/False or On/Off

A triplestate checkbox can have the three values of True/Yes/On (-1), False/No/Off (0) and grayed out (Null state).

The downloadable examples shows how to use the Triple State Property of a Check Box to return values in a query relating to the selection made. You can use the TripleState property to specify how a check box, toggle button, or option button will display Null values.

After a selection is made in the Check Activity check box, the user can then use the Run Query command to run a CASE statement.

The Case statement runs the query dependant on the value returned from the Check box.

In the Triple State property this can be either Yes(-1), No(0) or Null.

Selecting data to return from the query using the TripleState property of the checkbox.
Selecting data to return from the query using the TripleState property of the checkbox.

To see this example, download the Microsoft Access 2000 database example file from either the Microsoft Access Forms page or from the Microsoft Access Downloads section of the website.