Hello,
I am working on a solution in MS Access 2000 that creates a number of reports, then saves them to a shared drive on our metwork. I finally found out how to print to the Adobe printer in the VBA code, but now I have another problem : the code iterates through a group of the same reports for a number of different customers. When the code cycles through to the second pass, and opens a report, let's call it "Details", that has already been saved off for another customer, it can't be saved because it has the same name as the previous one that was saved. The requirements are to have it completely automated, so the user doesn't have to go through the "Save As" dialogue. My question is, is there some way I can accomplish the same thing that the "Save As" dialogue would, behind the scenes, i.e. save the file as "Details_2"? I have read the API reference, and am fairly confident I could do it through the file scripting object, and using some other tricks, but I am wondering if there is an easier way I may not be aware of. Any help is greatly appreciated. Thank you...
By the way - here is the code I am using to print to PDF :
Set myPrinter = Application.Printer
Set Application.Printer = Application.Printers("Adobe PDF")
DoCmd.OpenReport "Details", acViewPreview, , , acWindowNormal
DoCmd.PrintOut acPrintAll, 1, , acDraft, 1
Set Application.Printer = myPrinter
Your are supposed to be able to do this. This is done by setting some windows registry entries. I was doing this and it worked great for me using Windows XP and the Adobe PDF Printer version 7. The code would go through the database and print around 70 different PDF files each with a name assigned by the code. Now I am using Vista Ultimate x64 with Adobe PDF Printer 8.1. Unfortunately for me, this procedure is now not working even though the Distiller documentation says it can be done. Whether you can set registry entries using VBA I don't know.
Anyway, check out the Distiller documentation Here is a cut and paste of how it is supposed to work.
Prompting can be turned off programmatically by adding a key to the Windows registry. This method applies to the creation of only one PDF document by a specific application for the current user. To use this method, add the following registry key:
HKEY_CURRENT_USER\Software\Adobe\Acrobat Distiller\PrinterJobControl
This key takes as subkeys:
(Default)
application
The (Default) entry is reserved for possible future use and is not to be used.
The application subkey is the full path of the application for which prompting is to be turned off. The value of the application subkey is a REG_SZ value that is the full path of the output file. For example, the following registry script would turn off prompting for the next printing performed by wordpad.exe, printing to the file c:\MyPDFoutputFileName.pdf:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Adobe\Acrobat Distiller\PrinterJobControl]"
C:\Program Files\Windows NT\Accessories\wordpad.exe" = "c:\MyPDFoutputFileName.pdf"
I hope this helps.
Larry