[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Access VBA - automatically converting a report to PDF and emailing

Posted on 2010-08-15
10
Medium Priority
?
324 Views
Last Modified: 2012-08-14
Hi

What Access VBA code would I use to automatically generate a report?

Thanks
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 48

Expert Comment

by:Dale Fye
ID: 33441506
not sure what you mean by "automatically generate a report"?

You can design a report by creating a query, then using the report wizard to create the report, but I've never heard of "automatically generate a report".

Or do you just want to run a report from a command button?  If this is what you had in mind, you can either use the control wizard when adding a command button, or write the code yourself.  If this is what you had in mind, post back.
0
 

Author Comment

by:Murray Brown
ID: 33441553
I found the following code. I want to convert an open report called "Invoice" to a PDF file then email it
from any email system

DoCmd.OutputTo acOutputReport, "Invoice", acFormatPDF, myFileName
0
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 600 total points
ID: 33441757
I'm not sure whether the SendObject method works with "any email system", but that I would look at the examples associated with that method in Access help.  If that doesn't work for you, then search in EE solutions on SendObject.  You will find lots and lots of posts on that subject.
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Assisted Solution

by:JAndreassen
JAndreassen earned 400 total points
ID: 33442041
I use this command to send a report as PDF from my Outlook and it works perfectly. Just have to allow Access to use Outlook, a popup box.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 1000 total points
ID: 33449049
Then do this:

DoCmd.SendObject acSendReport, "YourReportName", acFormatPDF, "SomeEmailAddress", , , "SomeSubject", "SomeMessage", False


This presumes Access 2007 with the PDF add in installed.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33449088
Also remember, that in Access 2007, ...when the report is open you can click:
Office Button-->Email-->PDF Format

JeffCoachman
0
 

Author Comment

by:Murray Brown
ID: 33449124
Thanks very much. If I am going to install my application on other people's machines then is using PDF the best option?
0
 

Author Closing Comment

by:Murray Brown
ID: 33449133
thanks very much
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33449204
<I found the following code. I want to convert an open report called "Invoice" to a PDF file then email it
from any email system>

...Sorry, I just read this...

If you want to email with "Any email system" you will have to use any of the available "Emailing" programs:
CDO:
http://www.google.com/#hl=en&q=VBA+Microsoft+Access+cdo+email&aq=f&aqi=&aql=&oq=&gs_rfai=&fp=8631cdd35a4d476d

FMSINC:
http://www.fmsinc.com/MicrosoftAccess/Emails.asp

There are others as well, do a search here or on google.

;-)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33450001
<Thanks very much. If I am going to install my application on other people's machines then is using PDF the best option?>
Probably, as most people have Acrobat loaded on their machines already.
Also, under normal circumstances, a PDF cannot be edited.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

649 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