How do I toggle a checkbox.

N

Neil

I want my users to be able to select either yes or no to a quesiton in a
form. Basically a toggle checkbox that if yes is selected no is de-selected
and visa versa. My data field is currently Yes/No.
 
M

Mark Phillipson

Hi,

Make sure the Control Wizard button is down on your toolbox toolbar.

Then create an OptionGroup following the wizard. Opt to assign -1 and 0 to
the Yes and No options.

Provided you select the correct options that should about do it.

--
HTH

Mark Phillipson

Free Add-Ins at; http://mphillipson.users.btopenworld.com/
 
B

Bruce

Something I did when the Yes and No checkboxes were aleady part of a database
I inherited was to put the following in the after update event for one
checkbox (assuming your checkboxes are named chkYes and chkNo):

Private Sub chkYes_AfterUpdate()

If Me.chkYes = -1 Then
Me.chkNo = 0
Else: Me.chkNo = -1
End If

End Sub

For chkNo I just substituted chkYes for chkNo and vice versa. It seems to
work, but I would have considered an option group had I been designing the
database from scratch.
 
D

Douglas J. Steele

Or, shorter:

Private Sub chkYes_AfterUpdate()

Me.chkNo = Not Me.chkYes

End Sub
 
Top