VBA Code to Convert Report to PDF

GeneralShamu

Board Regular
Joined
Jul 6, 2007
Messages
127
Here is the code I am trying to run:
Forms![FormName]![LstBSource] = "SourceName"
Forms![FormName]![LstBVariable] = "VariableName"
DoCmd.OpenReport "ReportName", acViewDesign
Reports![ReportName].Caption = "VariableName"
DoCmd.OpenReport "ReportName", acViewNormal

For some reason though, it does not work, the pdf that is created is blank where charts/data would be pulled in. (The page is not completely blank, there is a title and column headings.)

I have several SourceName/Variable Name combinations (100+) so I have these 5 lines of code repeated as many times in one big VBA code file in Access.

What am I doing wrong to convert this to a PDF?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

jackd

Well-known Member
Joined
Oct 19, 2006
Messages
1,419
Office Version
  1. 365
Platform
  1. Windows
Here is the code I am trying to run:
Forms![FormName]![LstBSource] = "SourceName"
Forms![FormName]![LstBVariable] = "VariableName"
DoCmd.OpenReport "ReportName", acViewDesign
Reports![ReportName].Caption = "VariableName"
DoCmd.OpenReport "ReportName", acViewNormal

For some reason though, it does not work, the pdf that is created is blank where charts/data would be pulled in. (The page is not completely blank, there is a title and column headings.)

I have several SourceName/Variable Name combinations (100+) so I have these 5 lines of code repeated as many times in one big VBA code file in Access.

What am I doing wrong to convert this to a PDF?

I'm not sure what software versions you are using, but here is a l ink to a site with responses to a similar question.

http://www.tek-tips.com/viewthread.cfm?qid=1510461&page=8


Here is another link to a popular site that claims to have a routine to convert Access Reports and Snapshots to pdf.

http://www.lebans.com/reporttopdf.htm
 
Last edited:
Upvote 0

seenfresh

Well-known Member
Joined
Jul 12, 2006
Messages
1,141
Greetings,

I couldn't help notice this thread is related to a task I am trying to accomplish...

I need to convert "multiple" ms access reports into "one" pdf file using vba. This thread details how to convert one ms access report into a pdf file at a time, but I am curious how to get multiple reports to convert together. This option is available using the Adobe Professional version 8, or 9.

Does anyone have any ideas or related articles that detail this objective?

Any suggestions would be amazing...

Cheers
 
Upvote 0

Forum statistics

Threads
1,191,177
Messages
5,985,138
Members
439,941
Latest member
robertv13

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top