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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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
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,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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
Back
Top