checkbox annoyance

  • Thread starter customer7billion
  • Start date
C

customer7billion

It's probably really really basic but,

I have several checkboxes on my form, and wish to obtain a yes or no
value when they are checked. for example, I want to get something like
this:

Private Sub checkboxA_Click()

If 'checkboxA is selected' then
variableA = something
elseif variableA = something_else
end if

End Sub

I'm just not sure how to do the 'if checkboxA is selected' bit

thanks for any help i might recieve.
 
K

Keith Wilby

It's probably really really basic but,

I have several checkboxes on my form, and wish to obtain a yes or no
value when they are checked. for example, I want to get something like
this:

Private Sub checkboxA_Click()

If 'checkboxA is selected' then
variableA = something
elseif variableA = something_else
end if

End Sub

I'm just not sure how to do the 'if checkboxA is selected' bit

thanks for any help i might recieve.

A check box returns "True" if it's checked and "False" otherwise. The math
equivalents are -1 for True and 0 for False. So you can use either:

If chkMyCheckBox
'True case
Else
'False case
End if

or

If chkMyCheckBox = -1
'True case
Else
'False case
End if

and variations on that theme.

HTH - Keith.
www.keithwilby.com
 

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