Prev: Insert Form in Page
Next: shell running multi instance
From: Dee on 16 Apr 2010 13:16 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
From: Marshall Barton on 16 Apr 2010 14:32 Dee wrote: >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() -- Marsh MVP [MS Access]
|
Pages: 1 Prev: Insert Form in Page Next: shell running multi instance |