closing text box

B

Brian

The following code opens a second date box when
required, but when I move to the next record, the box is
still visible. Obviously I would like it to be closed.
What do I add to the code?
Any help gratefully accepted!
Thanks
Brian

Private Sub Attended_AfterUpdate()
If Attended = "Rebooked" Then
seconddate.Visible = True
ElseIf Attended = "DNA" Then
seconddate.Visible = True
Else
seconddate.Visible = False
End If
End Sub
 
C

Chaplain Doug

Set the form's OnCurrent event to a procedure. Do this by
viewing the form's properties and selecting the Events
tab. Once you select "Procedure" for the OnCurrent event,
press the button just to the right of it that has ... on
it. This will take you to the procedure. Enter the code:

seconddate.Visible = False

This will turn off the control each time you move from
record to record (even if the control is already off). if
that bother you then use:

if seconddate.Visible then seconddate.Visible = False
 
M

Marshall Barton

Brian said:
The following code opens a second date box when
required, but when I move to the next record, the box is
still visible. Obviously I would like it to be closed.
What do I add to the code?
Any help gratefully accepted!
Thanks
Brian

Private Sub Attended_AfterUpdate()
If Attended = "Rebooked" Then
seconddate.Visible = True
ElseIf Attended = "DNA" Then
seconddate.Visible = True
Else
seconddate.Visible = False
End If
End Sub


Execute the above code in the form's Current event too.

This is easy to do by just calling the above procedure:

Sub Form_Current()
Attended_AfterUpdate
End Sub
 
G

Guest

Thank you to all who replied! Chosen Marsh's option as
it the easiest!! Thanks again.
 

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