Make field Visible/Invisible

D

Dee

I would like the employee end date field to be invisible if it is null or
active, and visible if it is inactive. It works as it is below but I want it
to be specific to the record (employee) they are on (autonumber =
autonumber)? Also, I want to add a "is not null" statement but dont know the
code or exactly where to place it. I have read other posts but still need
some assistance. Thank you in advance.

Private Sub EmployeeStatus_AfterUpdate()
If Me.EmployeeStatus = "Inactive" Then
Me.EmpEndDate.Visible = True
Else
Me.EmployeeStatus = "Active"
Me.EmpEndDate.Visible = False
End If
End Sub
 
M

Marshall Barton

Dee said:
I would like the employee end date field to be invisible if it is null or
active, and visible if it is inactive. It works as it is below but I want it
to be specific to the record (employee) they are on (autonumber =
autonumber)? Also, I want to add a "is not null" statement but dont know the
code or exactly where to place it. I have read other posts but still need
some assistance. Thank you in advance.

Private Sub EmployeeStatus_AfterUpdate()
If Me.EmployeeStatus = "Inactive" Then
Me.EmpEndDate.Visible = True
Else
Me.EmployeeStatus = "Active"
Me.EmpEndDate.Visible = False
End If
End Sub


Your code looks ok to me. If the form can display more than
one record, then you need to run the same code in the form's
Current event. Rather than having two copies of the code,
you can just call the the AfterUpdate procedure from the
Current event using either:
EmployeeStatus_AfterUpdate
or
Call EmployeeStatus_AfterUpdate()
 

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