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

SendObject

Status
Not open for further replies.

vlingen

Programmer
Aug 4, 2006
31
US
I am currently using the DoCmd.SendObject to create a MS Outlook email with an attached Report file.

DoCmd.SendObject acSendReport, rsSteamship!ReportName, acFormatRTF, rsSteamship![EmailAddress], , , "Subject line of email", EmailBody

It works great. Now what I'd like to do is add the content of the Report into the body of the email. The reason for this is the end user would like to do searches in Outlook for specific "report" information. The Outlook Search doesn't look at the attachment.

I understand that the body of the email has to be in MS DOS text format. It will be important that the data in the body of the email be in columns.

Any ideas?
Thanks.
 
You would write code that creates the dataset you want, loop thru each row and create the columns by making one long string with tabs (chr(9)) and carriage returns (chr(13)).

So you end up building something like:

strBody = "CustomerID" & chr(9) & "Customer Name" & chr(13) & "15" & chr(9) & "Microsoft" & chr(13) & "17" & chr(9) & "Xerox" & chr(13) etc etc

start your string with your headings, then make a loop to go thru the recordset and add each "row" of data to the long string. Then plunk the string into the BODY portion of your SendObject statement.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top