Default Path for Save As Dialog for Printing Report to PDF

C

Cheryl

I'm using Access 2002 for XP. I have several reports that are set to print to
a PDF file as the default, but I'd like to be able to default to the
directory where they are to be saved without the user having to browse to
find it. I've read several threads relating to the api0001 dialog, but can't
seem to figure out how to adapt that to my needs.

I use this command to print the reports:

DoCmd.OpenReport rptATLAssocFY, acViewNormal

Can someone point me in the right direction?

Thanks!
 
D

dymondjack

I was hoping for something more simple for simple minds like

hmm... no such luck there <g> (at least not that I'm aware of). You can try
to look under the default settings for your adobe printer (in the control
panel) and see if it allows you to set a default path, but that's probably
the best you're going to get without writing code that may wind up being as
advanced as that in the reporttopdf modules.

On the brighter side, the reporttopdf is actually very easy to use, if you
don't look too hard at everything going on behind the scenes. Once it's set
up it basically runs off one function with two arguments (the report name and
path).

It's been a while since I set this up, but there's two files (.dll's) that
go in the same folder as the database you're running (the frontend). Then
there's the module to import. Import the mdule, compile and save, make sure
the two dll's are there, and you should be all set.

Then, to actually use it, it's as easy as this:

ConvertReportToPdf "MyReport", , "C:\Test\MyReport.pdf"

There's a whole slew of optional agruments, which is great for finetuning,
but most people can easily get away with only using the report name and path,
leaving the optionals as their defaults.

(The second argument of the function is if you want to use a snapshot file
instead of a report, leave that blank)

I think this would by far be your best bet. Maybe you can find this under
the control panel and set a winuser-wide default, but if I remember correctly
there's no option for that, and if you distribute this to other users you
won't have much control over it.

There may be a very quick and easy way, but if there is, I'm not aware of
it. I would definately spend a few hours trying to set up ReportToPDF... it
will be well worth it and generally only needs to be done once.

If you do go that route and run into some trouble setting up there's plenty
of people here to give a hand.

hth

--
Jack Leach
www.tristatemachine.com

- "Success is the ability to go from one failure to another with no loss of
enthusiasm." - Sir Winston Churchill
 
C

Cheryl

Thanks Jack. I'll try to work with this and figure it out. I appreciate your
quick response.

Cheryl
 
C

Cheryl

I've finally gotten back to this project, and put the ConvertReportToPDF code
in my project. However, when I try to compile, I get an error "User Defined
Type Not Defined", and it highlights this line of code:

Set clsDialog = New clsCommonDialog

clsDialog is declared as an Object

This is used throughout the code, so I'm dead in the water until I can
figure out what's wrong with this. Any direction on how to fix this?

Thanks in advance,
Cheryl
 
C

Cheryl

Success! The problem was that I imported the ReporttoPDF module, but did not
import the clsDialog class module along with it. It's working perfectly now,
thanks so much!

Cheryl
 

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