Help with check box selection

W

weircolin

Hi

I have a check box on a form and I am trying to make it that when it is
selected (ticked) it will display a text box. It is kind of workin,
like when it is selected the text box isn't showing, and when it isn't
selected the text box IS showing!

Can anyone help with this?

Private Sub Prof_Click()
If Me.Prof.Value = Yes Then

Organisation.Visible = True
Designation.Visible = True
Else
Organisation.Visible = False
Designation.Visible = False
End If
End Sub

Thanks

Colin
 
D

Douglas J. Steele

Is this a bound textbox, and your problem occurs when you move from record
to record? You'd need to put code in the form's Current event as well as in
the Click event.

Note that you can simplify that code to:

Organisation.Visible = Me.Prof.Value
Designation.Visible = Me.Prof.Value
 
W

weircolin

Hi

Thanks for that, its working alright now. But for some reason when I
go to the next record it continues to show the two text boxes if that
particular record doesn't have the check box ticked.

I hope that makes sense?

I have put it in the On Load of the Form and also on the on Click of
the box.
 
D

Douglas J. Steele

I suggested putting it in the form's Current event, not its Load event.
 

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