closing text box

  • Thread starter Thread starter Brian
  • Start date Start date
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
 
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
 
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
 
Back
Top