Solved

Access VBA - SendObject - change name of report being sent

Posted on 2010-08-23
3
620 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

707 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

13 Experts available now in Live!

Get 1:1 Help Now