SendObject (automatic e-mail)

JHENDRYX

Registered User.
Local time
Today, 14:07
Joined
Aug 9, 2002
Messages
16
I have set up a form that will trigger a SendObject e-mail alert depending on what information is entered. For example: when a shipment date is entered, an e-mail is triggered that says the shipment has been sent. What I need to know is if there is a way to automatically include the project name that is associated with the shipment in both the subject line and the message line of the e-mail. The way it works now is...I have the e-mail set up to allow edits and I have to manually fill that information in, but I would like it to just default there . I hope this makes sense.

Thanks,

Jennifer:confused:
 
The full command line, with parameters, for the DoCmd.SendObject method is

DoCmd.SendObject [objecttype][, objectname][, outputformat][, to][, cc][, bcc][, subject][, messagetext][, editmessage][, templatefile]

So if somewhere on your form you have a field which displays the project name, ie txtProject, just insert refer to the field in your subject and message parameters.

like

DoCmd.sendObject acSendNoObject,,,someone@somewhere.com,,,"Shipment sent for project " & me!txtproject, "The shipment has been sent for the project " & me!txtproject,false
 
Everything works great except it does not show the e-mail recipient. I tried to type it in using the persons e-mail address and it comes up with an error. Any suggestions?

Thanks,

Jennifer:rolleyes:
 
If you have used Charityg's code verbatim, then you will need to enclose the email address in double quotes ie: "someone@somewhere.com"

DoCmd.sendObject acSendNoObject , , , "someone@somewhere.com" , , , "Shipment sent for project " & me.txtproject , "The shipment has been sent for the project " & me.txtproject , false

If you are referencing a text box on the form, then there is no need for ""

DoCmd.sendObject acSendNoObject , , , me.txtEmailAddress , , , "Shipment sent for project " & me.txtproject , "The shipment has been sent for the project " & me.txtproject , false

HTH

Brad
 
That worked GREAT!!:D Thanks for the advice from both of you!!!

Jennifer
 

Users who are viewing this thread

Back
Top Bottom