We help IT Professionals succeed at work.
Get Started

Why does my Access Report not get saved as a PDF file?

colinasad
colinasad asked
on
188 Views
Last Modified: 2016-02-11
I am developing an Access 2007 "project" (.ADP) as a front-end to a SQL Server 2005 Express database.

Several of my Access Reports get printed then successfully saved as a PDF file using the following VBA code :

DoCmd.OpenReport strReportName, acViewNormal, , , , strOpenArgs
DoEvents
If Not genAllBlanks(strArchiveFile) Then
           DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strArchiveFile
End If
DoCmd.Close acReport, strReportName


Howver, I have been stumped all day on this with a new Report that I am creating! My report "prints" OK, but the PDF file just does not get created. In fact, I don't think the Sub Procedure in which this happens is being completed because I do not get a "Message Box" as it is exitted.
This Report is a very simple, single-page report and this type of code works OK with other more compicated reports that involve various fonts and graphics.

I read on one web-site that the PDF export function doesn't like too much VBA code in the Report, so I stripped all that out (there was a couple of calls to some SQL Server Stored Procedures) but that did not solve it. I have also changed the path name for my strArchiveFile variable but with no success.

Can anyone suggest why this technique which has worked for me over several years on much larger reports, be causing this problem?

Many thanks. Colin.
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE