I had an older laptop with XP & Office 2003, now I have a new laptop with XP & Office 2007 (work computer, thus XP).
Anyway, I've had no trouble outputting the following code to PDF in the past, now it executes each line of code but doesn't execute the DoCmd.OutputTo section.
I added Msgbox's to provide me the troubleshooting necessary to identify where it fails. Every msgbox pops up except the "Output Successful!". No error messages, just nothing.
I've tried messing with the references and installing the Window for Office PDF addin. I might have messed something up when I converted the original database from 2000 format to 2007?
Can you please help?
' Define variables
Dim ReportName As String
Dim ExportName As String
Dim ExportLoc As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim intRecordID As Integer
Dim x As Integer
Dim qdfNew As DAO.QueryDef
Set dbs = CurrentDb
' Open recordset
Set rst = dbs.OpenRecordset("tblFinalTCS2")
MsgBox rst.RecordCount 'used to test record count is accurate
' Define loop to go thru every record until end
Do While Not .EOF
MsgBox "intRecordID = " & intRecordID 'Test
' Set integer to autonumber in recordset
intRecordID = !ID
MsgBox "rst!ID = " & !ID 'Test
' Create QueryDef.
sqlQryDef = "SELECT * FROM tblFinalTCS2 WHERE ID = " & intRecordID
Set qdfNew = dbs.CreateQueryDef("FedByEmpIDQueryDef", sqlQryDef)
MsgBox sqlQryDef 'Test
' set strings
ReportName = "rptTCS_FinalFormat2"
MsgBox ReportName 'Test
ExportLoc = "c:\TEMP2\"
MsgBox ExportLoc 'Test
ExportName = rst("EMPID") & "-2011-TC"
MsgBox ExportName 'Test
' Output PDF w/ExportName to ExportLoc
DoCmd.OutputTo acOutputReport, ReportName, "PDFFormat(*.pdf)", ExportLoc & "\" + ExportName & ".pdf", False, "", 0, acExportQualityPrint
MsgBox "Output Successful!" 'Test
' Delete QueryDef
Set dbs = Nothing
Thank you, Jeff