Solved

Access VBA - SendObject - change name of report being sent

Posted on 2010-08-23
3
634 Views
Last Modified: 2012-08-14
Hi

I want to change the name of the report being sent using the following VBA code:
 DoCmd.SendObject acSendReport, "MyReport", acFormatPDF, oEmailAddress, , , oSubject, oBody

I need "MyReport" to change to another name when attached eg "Report Week 1"
0
Comment
Question by:murbro
3 Comments
 
LVL 8

Expert Comment

by:fabriciofonseca
ID: 33505154
Actually this is the piece of the code where you put the name of the report you are exporting.

If you want to change it, just write there the name of any other report you want to export.


Is it part of a bigger code? The question does not make much sense the way it is now. Could you support us with more details?
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 33506218
You can't really automate this in the manner you wish. You can use other code to "print" the report to a file (like a PDF, for example), then use automation to use Outlook (or some other client) to send the email. Since you didn't mention what version of Access you're using it's hard to advise further.

Access 2007 includes an addin that can be used to print a file to PDF.

Access 2003 or earlier needs additional handling (see the Lebans PrintToPDF utility: www.lebans.com)
0
 

Author Closing Comment

by:murbro
ID: 33525466
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now