Make a form field invisible

  • Thread starter Thread starter AJ
  • Start date Start date
A

AJ

I have 4 input fields on a form and if a user starts typing in one, I would
like 2 other ones to become invisible or not allow the user to input into
them.
Example.
employeeNum field
department_id
or
ss_num
birthdate

I only want them to populate either the first two or last two and would like
to eliminate the chance that they can populate both sets.

Is this possible? Thanks.
 
AJ,
It would be better to use each field's AfterUpdate event, rather than
when typing begins.
Let's say the user enters a value in the EmpNo...

Private Sub EmpNo_AfterUpdate
If Not IsNull(EmpNo) Then
SSNum.Visible = False
BirthDate.Visible = False
Else
SSNum.Visible = True
BirthDate.Visible = True
End If
End Sub

This would also handle the case where the user deletes the EmpNo entry.

Use the same logic for your other three fields.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
You can lock, disable, or hide any control that does not have the focus.

Me.employeeNum.Visible = False
Me.employeeNum.Locked = True
Me.employeeNum.Enabled = False
 
Back
Top