Solved

Access VBA - SendObject - change name of report being sent

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

Question has a verified solution.

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

Suggested Solutions

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

770 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