Checkbox Visible Property

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

I currently use a checkbox that simply changes the view of
another item on the form: (AS Follows)

'Hides And Unhides the Attention bar at the top of the
Form window
Private Sub chkneed_Click()
If chkneed.Value = True Then
Me.attention.Visible = True
End If
If chkneed.Value = False Then
Me.attention.Visible = False
End If
End Sub

However, when i cycle through each record, sometimes the
you can see the box even though chkneed = False.

Hope i've explained it ok, can anyone help?

Thankyou in Advance
 
Jason,
Usually when the value of a control controls the display of an object on
the form, there a re 2 events involved... the AfterUpdate event of chkNeed
and the OnCurrent event of the form.
You say... >>> However, when i cycle through each record, sometimes the
you can see the box even though chkneed = False.
Moving from record to record (browsing) won't fire the OnClick event of
chkNeed.

Try this... on chkNeed's AfterUpdate event...
If chkneed.Value = True Then
Me.attention.Visible = True
Else
Me.Attention.Visible = False
End If

And on the form's On Current event...
If chkneed.Value = True Then
Me.attention.Visible = True
Else
Me.Attention.Visible = False
End If
hth
Al Camp
 
You need to put the same code in the On Current event of the form as the code
only works after you click the check box and not when you move from record to
record.
 
The suggestions supplied by Al and Dennis should indeed do what you are
looking for, however, for the sake of brevity I would suggest the following:

Me.attention.Visible = chkneed.Value

Place this in both of the sections mentioned previously (the form even On
Current and the control event On Update).
 
Back
Top