Private Sub Date_Of_Brith_AfterUpdate()
If IsDate(Me.Date_Of_Brith) Then _
Me.Date_Of_Pension = DateAdd("yyyy", 50, Me.Date_Of_Brith)
End Sub
Private Sub Form_Current()
If Trim(Me.Date_Of_Pension & "") = "" Then
Call Date_Of_Brith_AfterUpdate
Me.Dirty = False
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
CurrentDb.Execute "update Emplyee Set [Date Of Pension]=DateAdd('yyyy', 50, [Date Of Brith])"
End Sub
Private Sub Form_Timer()
Dim lngCount As Long
Me.TimerInterval = 0
lngCount = DCount("*", "qryPension", "[Date Of Pension] <= Date()")
If lngCount > 0 Then
If MsgBox(lngCount & " of employees has reached their pension(s). " & _
"Would you like to view them?", vbInformation + vbYesNo) = vbYes Then
If SysCmd(acSysCmdGetObjectState, acQuery, "qryPension") <> 0 Then _
DoCmd.Close acQuery, "qryPension"
DoCmd.OpenQuery "qryPension"
End If
End If
End Sub