Send an email with a database object attached.
Syntax DoCmd.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile) Key ObjectType An AcSendObjectType constant that specifies the type of object to send. ObjectName The name of an object to email, of the type selected by the objecttype argument. To include the active object in the email, specify the object's type with ObjectType and leave this argument blank. If both ObjectType and ObjectName are blank Access will send an email without an included database object. OutputFormat An AcFormatType constant that specifies the The output format of the object being sent. To Names to put in the To line of the email. CC Names to put in the CC line of the email. Bcc Names to put in the BCC line of the email. Subject The email subject line. MessageText Text to include in the body of the email EditMessage Use True (-1) to open an email application so the message can be edited. Use False (0) to send immediately without editing. TemplateFile The full pathname of an HTML file to use as a template for the email.
Use SendObject() to include the specified Access datasheet, form, report, or module in an email.
Access will change much of the formatting when converting to email, forms will display as if in datasheet view, Yes no fields will appear as -1 or 0. When you send a datasheet, form, or data access page in HTML format, one .html file is created. When you send a report in HTML format, one .html file is created for each page in the report.
If you send a report, the only controls that are included in the object are text boxes (for .xls files), or text boxes and labels (for .rtf, .txt, and .html files). All other controls are ignored. Header and footer information is also not included. The only exception to this is sending a report in Excel format, a text box in a group footer containing an expression with the Sum function will be included in the object.
The message text of the email will be in plain text, in many email clients this will by default, render in the Courier New font but the choice of font for plain text emails can be configured under Tools | Options.
'email the table T_Sales to two people in a spreadsheet format:
DoCmd.SendObject acSendTable, "T_Sales", acFormatXLS, _
"Sergio Buzio; email@example.com", , ,_
"Spreadsheet of sales"
“Email is a wonderful thing for people whose role in life is to be on top of things. But not for me; my role is to be on the bottom of things. What I do takes long hours of studying and uninterruptible concentration” ~ Donald Knuth (Knuth versus Email)
Total Access Emailer - Utility from FMSinc that extends the functionality of SendObject()