Using DoCmd.OutputTo to save as pdf with specific name but want user to choose path

ML!

Registered User.
Local time
Today, 06:55
Joined
May 13, 2010
Messages
83
I want to be able to output a report to pdf and specify the filename but allow the user to select the path.

Currently using this...

Code:
DoCmd.OutputTo acOutputReport, "rptRateCard", acFormatPDF, ("RateCard" & Format(Now(), "mmmyyyy") & ".pdf"), True

If I leave the OutPutFile parameter blank, it brings up the windows save dialogue with the name of the report as the default. If I specify the file name, it doesn't give me the dialogue box and saves it to the default path. I want to define the filename as above but want the user to define the location to which to save it.

Any ideas?
 
Check out this by ghudson for getting a file name and path and then you can use variable in place of the file name. The variable you can set using the function (haven't seen the function so I won't show it here):
Code:
Dim strPathAndFile As String
 
strPathAndFile = "....put the function name by ghudson here"
 
DoCmd.OutputTo acOutputReport, "rptRateCard", acFormatPDF, [B]strPathAndFile[/B], True
 
Last edited:
Although I don't completely follow it, I will figure it out and I'm sure it's going to work brilliantly for me Bob - thanks!

Wondering if you or any one else knows much about MAC's. If this app is deployed on a Mac that is running Access as a native Windows app (I think he's running a Parallels Desktop www.parallels.com), since the function relies on Windows the Shell32 library, will it still run? I just wondered if you knew if a cross over app like that would build in a 'parallel' directory structure.

This is mostly just curiousity...all else fails, in this one deployment, I can give him the option to create the report then he can manually export to pdf letting the Mac help him decide where to store it.
 

Users who are viewing this thread

Back
Top Bottom