P
Perplexed
I have the following code input for an event procedure on a subform and it
works fine. If I ignore and cancel the email I can hit the "end" button and
move to the next record in the database.
Private Sub Form_Current()
If [CDLExpires] <= Date + 60 Then
DoCmd.SendObject acSendNoObject, , , To:="myemail@address", Subject:="Action
Needed", MessageText:="Employee: " & Forms.employees.FirstName & " " &
Forms.employees.LastName & vbCrLf & vbCrLf & "CDL Expires: " & [CDLExpires]
& vbCrLf & vbCrLf & "Please schedule appropriate appts with DMV",
EditMessage:=True
Else
End If
If [MedicalExpires] <= Date + 60 Then
DoCmd.SendObject acSendNoObject, , , To:="myemail@address", Subject:="Action
Needed", MessageText:="Employee: " & Forms.employees.FirstName & " " &
Forms.employees.LastName & vbCrLf & vbCrLf & "Medical Expires: " &
[MedicalExpires] & vbCrLf & vbCrLf & "Please schedule appt with Doctor",
EditMessage:=True
Else
End If
If [VTT] <= Date + 60 Or [GPPV] <= Date + 60 Then
DoCmd.SendObject acSendNoObject, , , To:="myemail@address", Subject:="Action
Needed", MessageText:="Employee: " & Forms.employees.FirstName & " " &
Forms.employees.LastName & vbCrLf & vbCrLf & "VTT Expires: " & [VTT] &
vbCrLf & vbCrLf & "GPPV Expires: " & [GPPV] & vbCrLf & vbCrLf & "Please
schedule appt with DMV ", EditMessage:=True
Else
End If
End Sub
However, when I enter similar code to just one above for a specific field in
the main form it goes into a continous loop and won't end or go to next
record. Sometimes it doesn't work at all. Is there a difference in entering
code in the main form for event procedures?
Thanks!
works fine. If I ignore and cancel the email I can hit the "end" button and
move to the next record in the database.
Private Sub Form_Current()
If [CDLExpires] <= Date + 60 Then
DoCmd.SendObject acSendNoObject, , , To:="myemail@address", Subject:="Action
Needed", MessageText:="Employee: " & Forms.employees.FirstName & " " &
Forms.employees.LastName & vbCrLf & vbCrLf & "CDL Expires: " & [CDLExpires]
& vbCrLf & vbCrLf & "Please schedule appropriate appts with DMV",
EditMessage:=True
Else
End If
If [MedicalExpires] <= Date + 60 Then
DoCmd.SendObject acSendNoObject, , , To:="myemail@address", Subject:="Action
Needed", MessageText:="Employee: " & Forms.employees.FirstName & " " &
Forms.employees.LastName & vbCrLf & vbCrLf & "Medical Expires: " &
[MedicalExpires] & vbCrLf & vbCrLf & "Please schedule appt with Doctor",
EditMessage:=True
Else
End If
If [VTT] <= Date + 60 Or [GPPV] <= Date + 60 Then
DoCmd.SendObject acSendNoObject, , , To:="myemail@address", Subject:="Action
Needed", MessageText:="Employee: " & Forms.employees.FirstName & " " &
Forms.employees.LastName & vbCrLf & vbCrLf & "VTT Expires: " & [VTT] &
vbCrLf & vbCrLf & "GPPV Expires: " & [GPPV] & vbCrLf & vbCrLf & "Please
schedule appt with DMV ", EditMessage:=True
Else
End If
End Sub
However, when I enter similar code to just one above for a specific field in
the main form it goes into a continous loop and won't end or go to next
record. Sometimes it doesn't work at all. Is there a difference in entering
code in the main form for event procedures?
Thanks!