Solved: Access Report VBA Question

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

dfriend846

Thread Starter
Joined
Aug 11, 2005
Messages
210
I just purchased Office 2007 so that I could e-mail reports as pdf files. This works fine and what I actually e-mail is a portion of the report as defined by a where clause or filter. When the report goes out in the e-mail it uses the report name as the file name i.e. "rpt R1 .pdf" The commands are in vba and are initiated by a button on a form.

Since I am only sending a portion of the data (e.g. item number 1234) and since I am sending the report because I have updated the data I would like my file name in the e-mail to be more descriptive. What would be good is a file name of "1234 revised 4-19-2007.pdf". Does anyone know how to do this?

The only way I have thought of is to use a DoCmd.CopyObject (or rename) to create a copy of my report object with the name "1234 revised 4-19-2007" and then run that and then delete it. I am pretty sure this could work but I feel there might be a better way.
 

dfriend846

Thread Starter
Joined
Aug 11, 2005
Messages
210
The solution to this is to first save the report output to a (pdf) file using the a command similar to the following:
DoCmd.OutputTo acReport, stDocName, acFormatPDF, stFileName
and then send an e-mail with the file as an attachment. This cannot be done with DoCmd.OutPutTo but can with a custom subroutine (free) from Peter's Software. Here's a discussion of the issue http://www.peterssoftware.com/c_emfa.htm and a link to the sub. It worked for me: http://www.peterssoftware.com/c_som.txt
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top