I have an employee form with an absence details continuous sub form. The absence sub form includes an absent type combo with options like holiday, sickness, TOIL etc. and also Sickness Reason Level 1 combo & Sickness Reason Level 2 cascading combo fields along with other various fields like start date, end date and employee ID fields.
I would like to make the Sickness Reason fields only visible when the absence type is Sickness.
I have done this attaching the following code to the after update property of the absence type combo field:
Private Sub Emp_Absence_Type_AfterUpdate()
If Emp_Absence_Type = "Sickness" Then
SickReason1Combo.Visible = True
SickReason2Combo.Visible = True
Else
SickReason1Combo.Visible = False
SickReason2Combo.Visible = False
End If
End Sub
This works fine however it affects the full record set of the continuous form rather than just the affected record e.g. even if say “holiday” is selected on a different record it makes the sickness reason fields visible or vice versa if “holiday” on the current record is selected it hides the sickness reason on other records even if the reason is sickness.
How can I show the sickness reason fields only on the current record without affecting other records in the sub form?