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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to include an OrderID number in the subj. line of an email

Status
Not open for further replies.

dragongunner0351

Programmer
Joined
Mar 16, 2006
Messages
104
Location
US
Hello all, I have a report that is emailed out of my database in snapshot format, I would like to automatically include the OrderID number of the order in the subject line of the email. Any help is greatly appreciated
 
How is the report emailed? Where is it emailed from?
 
I am emailing from a form via a command button my email program is outlook

Here is the code on the button:
Private Sub EmailWOREQ_Click()
Dim stDocName As String

stDocName = "WO REQ"
DoCmd.OpenReport stDocName, acPreview, , "[OrderID] = Forms![Orders].form![OrderID]"
DoCmd.SendObject acReport, stDocName, "Snapshot Format", "someone@somewhere.com", "someoneelse@somewhere.com", , "A work order request has been sent.", "Please see attached file"

End Sub
 
Try:
Code:
Private Sub EmailWOREQ_Click()
Dim stDocName As String

    stDocName = "WO REQ"
    DoCmd.OpenReport stDocName, acPreview, , "[OrderID] = Forms![Orders].form![OrderID]"
    DoCmd.SendObject acReport, stDocName, "Snapshot Format", "someone@somewhere.com", "someoneelse@somewhere.com", , "A work order request has been sent: " & Forms![Orders].form![OrderID], "Please see attached file"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top