Hi,
I'm developing a form for a database. The After Update event code is shown below:
Private Sub Form_AfterUpdate()
On Error GoTo Err_Form_AfterUpdate
Dim AlreadySent As Long
Dim day, month, year As String
Dim Today As Date
Dim Subject, msgtext, Name As String
day = Format((Date), "dd"
month = Format((Date), "mm"
year = Format((Date), "yyyy"
Today = day & "-" & month & "-" & year
AlreadySent = DLookup("[SentFinalEmail]", "[tblPersonalDetails]", "ID_pk = " & PreviousId)
'Set updated date
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE tblPersonalDetails SET LastUpdated = '" & Today & _
"' WHERE tblPersonalDetails.ID_pk = " & PreviousId)
DoCmd.SetWarnings True
'If all forms received, send email
If AlreadySent = 0 And _
Check58.value = True And Check62.value = True And _
Check104.value = True And Check110.value = True And _
chkEducationConsent.value = True And chkEmployerConsent.value = True Then
'set references from form
Name = Me!Name
Subject = "All Forms Returned"
msgtext = "Attention: " & vbCrLf & _
Name & " has returned all appropriate forms."
msgtext = msgtext & vbCrLf & _
"Attached is a personal report."
If Me!Combo48 = "Anomaly" Then
msgtext = msgtext & vbCrLf & _
"Please note that their entry has an anomaly."
End If
msgtext = msgtext & vbCrLf & vbCrLf & "Regards," & vbCrLf & "The BSC Team."
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE tblPersonalDetails SET SentFinalEmail = Yes " & _
"WHERE tblPersonalDetails.ID_pk = " & PreviousId)
DoCmd.SetWarnings True
DoCmd.SendObject acSendReport, "RptPersonalMain", acFormatRTF, GetAddresses(), _
, , Subject, msgtext, True
End If
Exit_Form_AfterUpdate:
Exit Sub
Err_Form_AfterUpdate:
MsgBox Err.Description
Resume Exit_Form_AfterUpdate
End Sub
When I use the form, compiled in an mde file, everything works ok. I'm using windows 98, access 2000. When someone else uses the same form, but using Windows nt 4 workstation, they get the following error after updating a record, and moving to the next one:
The expression After Update you entered as the event property setting produced the following error: Microsoft Access can't find the field 'Parent' referred to in your expression.
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event or macro.
Can anybody think of something I'm doing wrong? Any assistance will be greatly appreciated
I'm developing a form for a database. The After Update event code is shown below:
Private Sub Form_AfterUpdate()
On Error GoTo Err_Form_AfterUpdate
Dim AlreadySent As Long
Dim day, month, year As String
Dim Today As Date
Dim Subject, msgtext, Name As String
day = Format((Date), "dd"
month = Format((Date), "mm"
year = Format((Date), "yyyy"
Today = day & "-" & month & "-" & year
AlreadySent = DLookup("[SentFinalEmail]", "[tblPersonalDetails]", "ID_pk = " & PreviousId)
'Set updated date
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE tblPersonalDetails SET LastUpdated = '" & Today & _
"' WHERE tblPersonalDetails.ID_pk = " & PreviousId)
DoCmd.SetWarnings True
'If all forms received, send email
If AlreadySent = 0 And _
Check58.value = True And Check62.value = True And _
Check104.value = True And Check110.value = True And _
chkEducationConsent.value = True And chkEmployerConsent.value = True Then
'set references from form
Name = Me!Name
Subject = "All Forms Returned"
msgtext = "Attention: " & vbCrLf & _
Name & " has returned all appropriate forms."
msgtext = msgtext & vbCrLf & _
"Attached is a personal report."
If Me!Combo48 = "Anomaly" Then
msgtext = msgtext & vbCrLf & _
"Please note that their entry has an anomaly."
End If
msgtext = msgtext & vbCrLf & vbCrLf & "Regards," & vbCrLf & "The BSC Team."
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE tblPersonalDetails SET SentFinalEmail = Yes " & _
"WHERE tblPersonalDetails.ID_pk = " & PreviousId)
DoCmd.SetWarnings True
DoCmd.SendObject acSendReport, "RptPersonalMain", acFormatRTF, GetAddresses(), _
, , Subject, msgtext, True
End If
Exit_Form_AfterUpdate:
Exit Sub
Err_Form_AfterUpdate:
MsgBox Err.Description
Resume Exit_Form_AfterUpdate
End Sub
When I use the form, compiled in an mde file, everything works ok. I'm using windows 98, access 2000. When someone else uses the same form, but using Windows nt 4 workstation, they get the following error after updating a record, and moving to the next one:
The expression After Update you entered as the event property setting produced the following error: Microsoft Access can't find the field 'Parent' referred to in your expression.
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event or macro.
Can anybody think of something I'm doing wrong? Any assistance will be greatly appreciated