adraughn
asked on
Output To Snapshot
For some reason this code is giving me the "you need to install a printer" error. I have five installed. it breaks on docmd.output. here is the code:
Private Sub cmdLoop_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim strOldSQL As String
Dim strQry As String
Dim strRpt As String
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM qrySys_CreatePDF") 'Hazard/Engine combinations
Do While Not rs.EOF
strQry = "qrySys_CreatePDFSource"
strSQL = "SELECT h.[Haz_Trk_No] & [Engine_Mod] AS HTRModel, " & _
" h.[Haz_Trk_No] & [Engine_Mod] AS HTRModelTwo," & _
" h.Haz_Trk_No , h.Date_Open, h.SAR, h.Title, h.Assy_Desc, h.Part_Desc, h.Safety_Own," & _
" h.RootCause, h.WorklistDate, h.Hazdescpt, h.BriefHazDesc, ms.Engine_Mod, ms.Status," & _
" ms.Stat_Date, ms.Statusinfo, ms.TaskOwnr, ms.PlanContPlan, ms.RevContPlan," & _
" ms.ActlContPlan, ms.RiskAssess, ms.[ECP/TCTO Number]," & _
" ms.[TCTO/PPC Number], ms.QTR_status_AI_link, ms.pop, ms.Q_comp, ms.P_comp_date, ms.P_actions," & _
" ms.EPD, ms.ICA, ms.FCA, ms.FundingSource, ms.ActualNRIFSD, ms.ActualERLOA, ms.EventsSinceICA," & _
" al.[Statement No], al.Engineer, ms.RiskAssess" & _
" FROM (tbHAZARD AS h INNER JOIN tbMainSTATUS AS ms ON h.Haz_Trk_No = ms.Haz_Trk_No) " & _
" LEFT JOIN Assessment_Log AS al ON ms.RiskAssess = al.[Statement No]" & _
" WHERE (h.[Haz_Trk_No] & [Engine_Mod]) = " & "'" & rs!HTRModel & "'" & _
" ORDER BY h.[Haz_Trk_No] & [Engine_Mod] DESC , h.[Haz_Trk_No] & [Engine_Mod] DESC ," & _
" ms.Stat_Date DESC;"
strOldSQL = ChangeSQL(strQry, strSQL)
DoCmd.OutputTo acOutputReport, "rptHTRDetail_PDF", "Snapshot Format", "C:\Test.snp"
ResetDefaultPrinter
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Private Sub cmdLoop_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim strOldSQL As String
Dim strQry As String
Dim strRpt As String
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM qrySys_CreatePDF") 'Hazard/Engine combinations
Do While Not rs.EOF
strQry = "qrySys_CreatePDFSource"
strSQL = "SELECT h.[Haz_Trk_No] & [Engine_Mod] AS HTRModel, " & _
" h.[Haz_Trk_No] & [Engine_Mod] AS HTRModelTwo," & _
" h.Haz_Trk_No , h.Date_Open, h.SAR, h.Title, h.Assy_Desc, h.Part_Desc, h.Safety_Own," & _
" h.RootCause, h.WorklistDate, h.Hazdescpt, h.BriefHazDesc, ms.Engine_Mod, ms.Status," & _
" ms.Stat_Date, ms.Statusinfo, ms.TaskOwnr, ms.PlanContPlan, ms.RevContPlan," & _
" ms.ActlContPlan, ms.RiskAssess, ms.[ECP/TCTO Number]," & _
" ms.[TCTO/PPC Number], ms.QTR_status_AI_link, ms.pop, ms.Q_comp, ms.P_comp_date, ms.P_actions," & _
" ms.EPD, ms.ICA, ms.FCA, ms.FundingSource, ms.ActualNRIFSD, ms.ActualERLOA, ms.EventsSinceICA," & _
" al.[Statement No], al.Engineer, ms.RiskAssess" & _
" FROM (tbHAZARD AS h INNER JOIN tbMainSTATUS AS ms ON h.Haz_Trk_No = ms.Haz_Trk_No) " & _
" LEFT JOIN Assessment_Log AS al ON ms.RiskAssess = al.[Statement No]" & _
" WHERE (h.[Haz_Trk_No] & [Engine_Mod]) = " & "'" & rs!HTRModel & "'" & _
" ORDER BY h.[Haz_Trk_No] & [Engine_Mod] DESC , h.[Haz_Trk_No] & [Engine_Mod] DESC ," & _
" ms.Stat_Date DESC;"
strOldSQL = ChangeSQL(strQry, strSQL)
DoCmd.OutputTo acOutputReport, "rptHTRDetail_PDF", "Snapshot Format", "C:\Test.snp"
ResetDefaultPrinter
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
ASKER
that didn't work. same error.
is "rptHTRDetail_PDF" just a report ?
ASKER
yes, it is the name of my access report
can you run the report from the database window, not from code?
ASKER
no, anytime i try to run a report or open something in design view it tells me to install a printer.
do you have snapshot viewer?
ASKER
yes - i checked that, i do.
can you try this.
use the Northwind.mdb
create a command line like what you have using any report.
see if you get the same error...
use the Northwind.mdb
create a command line like what you have using any report.
see if you get the same error...
ASKER
thanks, but i fixed it. my print settings must have gone crazy when i was working with adobe. i rebooted and all is well. thanks for your help.
a
a
Is there any code in the report itself which checks or manipulates the printers?
""you need to install a printer"
Oddly enough, someone in our group had this issue recently ... wherein the printer most likely got hosed when they were messing with acrobat and happened to reboot ... at least that's the story I got ... which fixed the problem !! No doubt a long shot ... but hey ...
mx
Oddly enough, someone in our group had this issue recently ... wherein the printer most likely got hosed when they were messing with acrobat and happened to reboot ... at least that's the story I got ... which fixed the problem !! No doubt a long shot ... but hey ...
mx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
AcFormat can be one of these AcFormat constants.
acFormatASP
acFormatDAP
acFormatHTML
acFormatIIS
acFormatRTF
acFormatSNP
acFormatTXT
acFormatXLS
try using
acFormatSNP instead of "Snapshot Format",