frosty2000
Technical User
Hello,
I am tracking employee's benefits in an Access database and have designed a form for input. I would like to automatically calculate the Coverage Start Date based on +30 days from the employee's date of hire once the user selects the plan in which they are enrolled.
Below are a description of my fields:
MedicalPlan - The user selects the name of the medical plan in which the employee is enrolled
EmployeeMedicalCoverage - a checkbox that automatically is set to "Yes" if the user is enrolled in a plan
EmployeeMedicalCoverageStartDate - The effective date of benefits (30 days from latest date of hire)
LatestHireDate - The employees most recent hire date
I have successfully been able to get the checkboxes to work, but the EmployeeMedicalCoverageStartDate field is not populating. I am not getting an error - the field is just blank. Here's my code:
Private Sub MedicalPlan_AfterUpdate()
If [MedicalPlan] <> "Medical Declined" Then
[EmployeeMedicalCoverage] = True
[EmployeeMedicalCoverageStartDate] = DateAdd("d", 30, [LatestHireDate])
Else
[EmployeeMedicalCoverage] = False
[EmployeeMedicalCoverageStartDate] = [EmployeeMedicalCoverageStartDate]
End If
End Sub
Any ideas? Thanks!
frosty2000
I am tracking employee's benefits in an Access database and have designed a form for input. I would like to automatically calculate the Coverage Start Date based on +30 days from the employee's date of hire once the user selects the plan in which they are enrolled.
Below are a description of my fields:
MedicalPlan - The user selects the name of the medical plan in which the employee is enrolled
EmployeeMedicalCoverage - a checkbox that automatically is set to "Yes" if the user is enrolled in a plan
EmployeeMedicalCoverageStartDate - The effective date of benefits (30 days from latest date of hire)
LatestHireDate - The employees most recent hire date
I have successfully been able to get the checkboxes to work, but the EmployeeMedicalCoverageStartDate field is not populating. I am not getting an error - the field is just blank. Here's my code:
Private Sub MedicalPlan_AfterUpdate()
If [MedicalPlan] <> "Medical Declined" Then
[EmployeeMedicalCoverage] = True
[EmployeeMedicalCoverageStartDate] = DateAdd("d", 30, [LatestHireDate])
Else
[EmployeeMedicalCoverage] = False
[EmployeeMedicalCoverageStartDate] = [EmployeeMedicalCoverageStartDate]
End If
End Sub
Any ideas? Thanks!
frosty2000