Is my checkbox checked?

dickohead

Registered User.
Local time
Tomorrow, 07:34
Joined
Dec 7, 2005
Messages
42
Hey guys,

Having some trouble getting a VERY SIMPLE if statement to work.

I have a checkbox, if it's checked when my form loads, i want a rectangle to be visible. If it's not checked, do nithing. If I check it when using the form, make the rectangle visible.

The latter part I can do with chkCheckBox_Click().

But when my form loads, my if statement won't work.

But if i tell my form to make the rectangle visible outside of the if statement - it works.

Here is what I've got now:

Private Sub Form_Load()
If chkCheckBox = Checked Then
rctRectangle.Visible = True
Else
rctRectangle.Visible = False
End If
End Sub

I have also tried:

If chkCheckBox.Value = 1
If chkCheckBox.Value = True
If chkCheckBox = 1
If chkCheckBox = True

But thus far none have worked.

Can anyone point me in the right direction? From all the VBA examples I have seen, what I've got should be working!!!
 
This is the correct syntax:

If Me.chkCheckBox = True

or

If Me.chkCheckBox = -1
 
You little rippa!!!

Cheers mate.

:D
 

Users who are viewing this thread

Back
Top Bottom