VBA Code Reqd

uplink600

Registered User.
Local time
Today, 13:25
Joined
Mar 18, 2004
Messages
69
This may seem a simple problem but if anyone can help with some VBA code it would be a great help.

I have a label on a form in an access database. The form is a data entry form for the main table in the database. One of the fields is a yes/no and appears on the form as a standard check box.

The label in question has its visible property set to false so you cannot normally see it. I only want the label to be visible if when scrolling through the records that I mentioned above, the check box is checked (ie its value is -1) for that particular record.

I can't seem to find a suitable event make this work.

I would appreciate some assistance.
 
If I understand your setup right, then the OnCurrent event should work, with code looking something like this:

If Me.checkbox = True Then
Me.Label.Visible = True
Else
Me.Label.Visible = False
End If
 
Thank you

I'm not sure which control/object on the form this event should be on. Can you advise please.
 
uplink600 said:
Thank you

I'm not sure which control/object on the form this event should be on. Can you advise please.

The Current event is an event of the form object itself. You can select the form object in design view by clicking the little square at the upper and left ends of the rulers, or in the backround of the design window.

The Current event is the first item on on the events tab of the property sheet.

Leanest code for the job is...

Private Sub Form_Current()
...lblInQuestion.Visible = Me!chkBoxIsBoolean
End Sub
 

Users who are viewing this thread

Back
Top Bottom