General discussion

Locked

Access 2002

By Makita ·
In Access 2002, how can I click on a command button and send an email containing an excel spreadsheet with the results of a query? The query should be ran at the same time. Can this be done?

Thanks

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by iht4 In reply to Access 2002

Try the following command

expression.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)

Examples as shown in help file: This code includes the Employees table in a mail message in Microsoft Excel format and specifies To, Cc, and Subject lines in the mail message. The mail message is sent immediately, without editing.

DoCmd.SendObject acSendTable, "Employees", acFormatXLS, _
"Nancy Davolio; Andrew Fuller", "Joan Weber", , _
"Current Spreadsheet of Employees", , False

Change the acsendtable to acsendquery should provide you with the result you are looking for.

Good luck

Collapse -

by Makita In reply to

Poster rated this answer.

Collapse -

by Makita In reply to Access 2002

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums