Hide fields based on value

  • Thread starter Thread starter KLR
  • Start date Start date
K

KLR

I have placed the following code in the forms Current event and also
the Visit/report type control AfterUpdate event. It works as required
but then doesn't allow me to enter any data in the Event Name or
Institution field. Any ideas why?

Private Sub Form_Current()
If Me.[Visit/report type] = "External meeting" Then
Me.Institution.Visible = False
Me.Label10.Visible = False
Me.Event_Name.Visible = True
Me.Label22.Visible = True

Else

Me.Institution.Visible = True
Me.Label10.Visible = True
Me.Event_Name.Visible = False
Me.Label22.Visible = False
End If

End Sub
 
Did you try setting the following parameters too?

Me.Institution.Enabled
Me.Institution.Locked
 
Admittedly no, because I have used this code on another form (albeit
amended), and didn't have any problems.

The form was set as Continuous so users could add mutiple visit
information in a list, I have now amended it to Single and the code now
works fine, allowing data entry.
 
Back
Top