Create PDF from Access Report in a Terminal Services Environment
Posted on 2004-03-27
I have run into a wall with trying to programatically create PDF's from Access Reports.
We are running Adobe Acrobat version 6 (try before you buy version)
Windows Terminal Server
I do development on the database within my TS session.
I've modifed all the registry settings to set Adobe PDF Writer as the default printer. I've also set the PDFFileName value. As I step through the code, I have verified that the resgistry settings are being set.
My problem is that the Access report Defaults to My Documents\*.pdf, it does not use the file namein PDFFileName and according to the documentation I have found, that reg setting is reset after each write.
Amy I missing Something....Here is what I currently have.
'Save current default printer
strMyDefPrinter = RegRead("Software\Microsoft\WIndows NT\CurrentVersion\Windows", "Device")
'Set default printer to PDF Writer
RegWrite "Software\Microsoft\WIndows NT\CurrentVersion\Windows", "Device", "Adobe PDF,winspool,Ne02:"
SetKeyValueRegWord "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Adobe PDF\PrinterDriverData", "PromptForFileName", 0, REG_DWORD
SetKeyValueRegWord "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Adobe PDF\PrinterDriverData", "ViewPrintOutput", 0, REG_DWORD
SetKeyValueRegWord "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Adobe PDF\PrinterDriverData", "AskToReplacePDF", 0, REG_DWORD
'Setting value for PDFFileName in the registry stops file dialog box from appearing
RegWrite "Software\Adobe\Acrobat PDFWriter", "PDFFileName", "\\MVIConnect\sellsmart\ServiceTrack\" & Me.Project & "\" & strName
'Run the report
DoCmd.OpenReport "rptServiceTrackWorkOrderPDF", acViewNormal
I've even tried making a copy of the report and setting it's printer specifically to Adobe PDF, same problem.
I'm sure it has something to do with a registry setting. But not being a WTS expert, I'm missing something. I've searched the web for 2 days to solve this problem to no avail.
I found tons of comments on this website, but none of the 98 solutions were using WTS. I found a similiar thread, but it doesn't provide me with a working solution. By the way, sendkeys or something hokey like that is not an option.
Any insight into this problem would be greatly appreciated.
Mike (aka Data-Man)