DoCmd.SendObject, Customize object name (1 Viewer)

Leo_Polla_Psemata

Registered User.
Local time
Yesterday, 22:51
Joined
Mar 24, 2014
Messages
364
Hi
When we use DoCmd.SendObject, the object name is always the same name of table, query or report.

Can we customize object name to something else more descriptive?
For example
If I send the report "SalesPerSalesman" about John Smith,
the object name now is "SalesPerSalesman.pdf"
If i send the report "SalesPerSalesman" about Maryann Johns,
the object name would be again "SalesPerSalesman.pdf"

However , the object name I would like "SPS_JohnSmith.pdf"
and the report for Maryann Johns, I would like as object name "SPS_MaryannJohns.pdf"

Is this feasible ?



Syntax
DoCmd.SendObject ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile

ObjectName – Name of table, query, Report etc.
 

Minty

AWF VIP
Local time
Today, 05:51
Joined
Jul 26, 2013
Messages
10,355
The simplest route is to output the report as a pdf which you can program the name of, then attach that to the email.
The code is a little more complicated than the simple send object but gives you a lot more flexibility, like storing the report in a specific folder etc.
Look up DoCmd.OutputTo for the options
 

Users who are viewing this thread

Top Bottom