For those who need a bit more explanation, see below:
' This is the function of concern
Public Sub SaveReportAsPDF(strReportName As String, strPath As String)
Dim strOldDefault As String
' This string goes out and get the value for your "default" printer
strOldDefault = QueryKey("Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device"
' This string sets the default printer to a new value
SetKeyValue "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "Acrobat PDFWriter", REG_SZ
SetKeyValue "Software\Adobe\Acrobat PDFWriter", "PDFFilename", strPath, REG_SZ
SetKeyValue "Software\Adobe\Acrobat PDFWriter", "bExecViewer", 0, REG_SZ
DoCmd.OpenReport strReportName
' In this example, this sets the default back to what it was when this code started
SetKeyValue "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", strOldDefault, REG_SZ
End Sub
=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)
Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com