If Statement Help

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

This code does not work?
The control on the form is named Check107 and it's control source is
Selected
It is a Yes/No control
Label109 is just a label, that's it.

If [Check107] = No Then
Label109.Visible = True
End If
 
A checkbox holds a boolean value and should be compared to the intrinsic
constants of TRUE or FALSE.

Try this instead:

if me.Check107=False then
me.Label109.Visible = True
Endif

A slightly shorter version is this:

if Not me.Check107 then
me.Label109.Visible = True
Endif

If you want to toggle the visibility of the label you can do it in one
statement:

me.label109.visible=Not me.Check107
 
Your code might work if you used False instead of No.
However, it does not hide the label again when the check box is True.

Try:
Me.Label109.Visible = Not Nz(Me.Check107.Value, False)

You would probably want that in the AfterUpdate event procedure of Check107,
and then in the Current event of the form you would want this line:
Call Check107_AfterUpdate
 
Back
Top