Automated E-Mail text

shwin

Registered User.
Local time
Today, 08:01
Joined
Jun 15, 2004
Messages
20
Hi Everyone,

I am not sure what the best forum for this would be but I have some questions regarding automatic emailing through Access 2000. I actually got it working! :D I currently have it set up such that it will automatically send an email everytime the record has been changed using this code on the save button:

On Error Resume Next
Dim strToWhom As String
Dim strMsgBody As String
strToWhom = DLookup("Field", "Table", "Relationship")
strMsgBody = "This is a sample email"
DoCmd.SendObject , , , strToWhom, , , "This is a test email", strMsgBody, False

For each record I am saving, I would like to include some information from the record in the email body and in the subject heading. Any suggestions would be great.

Thanks for all of your help!
 
You could try something along these lines:

Code:
   str_Msg_Title = "Edits by" & CurrentUser & " on " & Date
    str_Msg_Body = "User changed: " & vbcr & vbcr & _
                    Me.field1.name & " to " me.field1.value

...

    DoCmd.SendObject , , , strToWhom, , , "This is a test email", strMsgBody, False

"Me" in a form's module represents the form itself. If you type "Me" then a dot, "Me." , you should get a list of the objects on the form, and you'll be able to select from this either by typing or by using the arrow keys.
 

Users who are viewing this thread

Back
Top Bottom