A2000ReportToPDF seems does not work on Access 2007

S

Song Su

I use lebans A2000ReportToPDF on Access 2003 and it works fine. However,
when I use Access 2007 to open my Access 2003 database, A2000ReportToPDF
seems not working. Any one know how to fix it? The website does not metion
Access 2007.

I know Access 2007 has own PDF button but the ribbon is not easy to
configure and it's not automatic.

http://www.lebans.com/reporttopdf.htm
 
S

Stephen Lebans

Can you be more specific on what the error is? If you are running under XP
then there is a security issue will calling Adobe Reader to display the
newly created PDF file. My routine does save the converted report to PDF but
security restrictions do not allow the programmatic invoking of Adobe
Reader.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
S

Song Su

Thank you, Lebans for reply. The error message I got when using Access 2007
to run my Access 2003 application is:

The OutputTo actino was canceled.
You used a method of the DoCmd jobject to carry out an action in Visual
Basic, but then clicked Cancel in a dialog box.
For example, you used the Close method to close a changed form, then clicked
Cancel in the dialog box that asks if you want to save the changes you made
to the form.

OK

This does not append if I use Access 2003 to run it. Can you help?

Thanks.

Song Su
 
S

Stephen Lebans

I do not use A2007 yet so I will have to ask some of my peers that do.
The error is being caused by my code's attempt to output the selected report
to Snapshot format. For some reason in A2007, this action is not available
at the same times it is in earlier versions.

I'll get back to you shortly.......

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
S

Stephen Lebans

A very knowledgeable developer says ReportToPDF works with A2007 and Vista.

So we are probably back to issue of the system not currently being able to
export a report to Snapshot format.
How are you calling my code? From a Button on a Form?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
S

Song Su

I put =ExportOpenReportToPDF() on action of a button on the custom toolbar
which always shows on toolbar area.
 
Z

Zac Woodall

Song Su, can you help me to understand what doesn't meet your needs in
the built-in Access 2007 PDF feature? You should be able to access it
via any of these methods:
- Office button --> Save As --> PDF or XPS
- Ribbon: External Data --> Export --> PDF or XPS
- Macro: OutputTo... OutputFormat: PDF Format
- VBA: DoCmd.OutputTo ..., acFormatPDF, ...

In addition, If you run it through the External Data ribbon, you can
create a saved export that will enable you to export it automatically
in the future to the same file using all of your current settings
without having to re-specify the information.

Thanks!
-Zac.
 
S

Song Su

Hi, Zac:

I wrote application in 2003 with custom toolbar to run Leban's ReportToPDF.
It works fine in 2003. However, a few people on campus start to use Access
2007 to run my 2003 application. Everything works fine under 2007 except
this custom tool bar button. I don't plant to write whole thing in 2007 as
majority of people still use 2003.

- Song
 
K

krissco

I put =ExportOpenReportToPDF() on action of a button on the custom toolbar
which always shows on toolbar area.

Song,

Open the database in A2007.

Put a break on the toolbar code:
http://groups.google.com/group/micr...b5b/a103f2abbf469f11?lnk=st&q=toolbar&rnum=1#

Export to PDF as you would in 2003.

Step through the code using F8. Where does the code fail? Is it in the
calling function (ExportOpenReportToPDF) or the called function
(ConvertReportToPDF)?

Something tells me that this line is the one that doesn't work:
DoCmd.OutputTo acOutputReport, Screen.ActiveReport.Name, acFormatSNP,
getTempSNPFile(), False

If that's the case, use Help in A2007 to determine how to call
DoCmd.OutputTo in order to get a snapshot file.
Type "?Screen.ActiveReport.Name" in the Debug window if the code
crashes at this line. Does it print the name of the report?

-Kris
 
S

Song Su

Kris,

I followed your instruction in A2007 and the error message is:

Run-time error '2501'
The outputTo action was canceled

I clicked 'Debug' button, it highlight the line exactly what you said:

DoCmd.OutputTo acOutputReport, Screen.ActiveReport.Name, acFormatSNP,
getTempSNPFile(), False [I am impressed]

I typed 'DoCmd.OutputTo' in A2007 help, it gives me:

expression.OutputTo(ObjectType, ObjectName, OutputFormat, OutputFile,
AutoStart, TemplateFile, Encoding, OutputQuality)

I don't see anything wrong with the code. (Maybe I'm too green to spot
anything). I'll be very thankful if you can offer any help. But the change
should not have any impact on those who still use A2003, the majority users.

Thanks.

- Song Su
 
K

krissco

kris,

Allen Browne said inhttp://allenbrowne.com/Access2007.html#Goodthat
'Custom Toolbar buttons may not work'. Do you think that this might be one
of the bugs?

Song

No idea. Put a break on the function, and step through your code. I
have no way to help you until I know where (specifically) the code
fails.

-Kris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top