Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

After update error using mde file

Status
Not open for further replies.

encode

Technical User
Jan 17, 2003
5
AU
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 :)
 
Hi,

It is nothing to do with this code.

You have referred to an object called "Parent" somewhere else.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Darrylles - thanks for your help. I just finished fixing the problem - and you are right - it was a problem with the after update event on the subform!!!
:)
 
Hi Encode,

Thanks, nice that you got back with a response - some don't even bother.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Hi,

I am having the same error message, and I think it's because I'm referring to the same object more than once in my VB code. It's strange that it works fine as
an .MDB file and not as an .MDE file, though.
How can you tell which SUB or OBJECT is being
repeated?

Thanks,
Christy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top