Event Procedures not working

P

Perplexed

For some reason my event procedure on the main form have stopped working. I
have the following procuredure on the main form:

Private Sub ProbationEnd_BeforeUpdate(Cancel As Integer)
If [ProbationEnd] <= Date + 15 Then
DoCmd.SendObject acSendNoObject, , , To:="myaddress inserted here",
Subject:="Action Needed", MessageText:="Employee: " &
Forms.employees.FirstName & " " & Forms.employees.LastName & vbCrLf & vbCrLf
& "Vacation Accrual Starts: " & vbCrLf & vbCrLf & "Prepare Personnel/Payroll
Change Form", EditMessage:=True
Else
End If
End Sub

The same procedure is on the two subforms with the only differences being
the reference to the control. It works great on the subforms. I can't
figure out why it has stopped working. Any suggestions?
 
S

Stuart McCall

Perplexed said:
For some reason my event procedure on the main form have stopped working.
I
have the following procuredure on the main form:

Private Sub ProbationEnd_BeforeUpdate(Cancel As Integer)
If [ProbationEnd] <= Date + 15 Then
DoCmd.SendObject acSendNoObject, , , To:="myaddress inserted here",
Subject:="Action Needed", MessageText:="Employee: " &
Forms.employees.FirstName & " " & Forms.employees.LastName & vbCrLf &
vbCrLf
& "Vacation Accrual Starts: " & vbCrLf & vbCrLf & "Prepare
Personnel/Payroll
Change Form", EditMessage:=True
Else
End If
End Sub

The same procedure is on the two subforms with the only differences being
the reference to the control. It works great on the subforms. I can't
figure out why it has stopped working. Any suggestions?

Forms is a collection and as such you need to use bang instead of dot in
order to refer to a member (a form). So the code:

Forms.employees.FirstName & " " & Forms.employees.LastName

ought to read:

Forms!employees.FirstName & " " & Forms!employees.LastName
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top