Triple State Check boxesUpload ImagesLink Michael Duncan 3 months ago
Hi guys I am building a movie database. I have a continuous form with all my titles on it including wish list and collection. I would like to use a triple state check box to view either list. My record source for the form is a table. How do I code the check box this way?
You will need to set up conditions on the status of the checkbox, then apply the SQL with a requery.
Dim strSQL As String
strSQL = "SELECT * FROM ..."
If (Check199) Then
strSQL = strSQL & "WHERE Status IN (x, y)"
Else
strSQL = strSQL & "WHERE Status IN (z, a)"
End If
Me.RecordSource = strSQL
'Me.Requery
This is covered in the SQL Seminar
you can thank Alex this was done by him about 8 years ago.
V/r
Juan
Gregory Clancey 3 months ago
Am I slow, or do I see only 2 conditions here -- cheque: TRUE / cheque: FALSE.
I may be failing to see how the 3rd condition directs program flow.
(note: The answer to my "Am I slow" question, above, may be self-evident.)
Kevin Robertson 3 months ago
Gregory,
This is how I would normally use a Triple State Check Box in this situation.
True: Show one list
False: Show the other list
Null: Show both lists
Gregory Clancey 3 months ago
Thanks. I'll work with this to gain familiarity.
So TRUE is chequed, FALSE is the empty box and NULL is a box with gray fill; and, we can inspect this state of the control to make the appropriate code branching.
Gregory Clancey 3 months ago
Sorry -- NULL is the box with the black fill. Once the control has been chequed, it can easily toggle between TRUE and FALSE via the spacebar, but is it possible to get back to NULL?
Juan C Rivera 3 months ago
if you click on it it will toggle thru the 3 null, true, false. I myself like radio buttons.
Gregory Clancey 3 months ago
Thanks, Juan.
Got it!
Rich has a great TechHelp vid. So, to enable the triple-state toggle the control must be bound to a Long Integer, Numeric table field (not the typical Boolean type) with a default of "NULL" and "Required Property" set to "No."
Typing this message will give me a quick place to refresh my memory in future. Also, others who happen upon this can become informed as well. Thanks again.
He has not updated the site for over 10 years but there are lots of valuable little tidbits there. Scroll all the way to the bottom and click the Home link to view more.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.