Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reports randomly cause access to crash

Status
Not open for further replies.

DonS100

Programmer
Dec 4, 2001
104
0
0
US
Hello, I added code from the below Microsoft article to get users default printer setting of A4 to show. It works fine but my users report that they
randomly(let's say every 30 time they run a report) get access error message and then have to restart the application. Is there anything wrong with my
code below?

Thanks

Don



Private Sub PrintDetailList_Click()
sRoutine = "PrintDetailList_Click"
gError.AddRoutine smodule, sRoutine
On Error GoTo Err_Routine

'*************************** ACTIVE CODE ******************************
Dim sSQL As String
Dim sParam As String
Dim qryName As String

sSQL = "psp_InvoiceSearchReport "
sParam = vbNullString
sParam = spAddParameter(sParam, Me.PODetailID, "Number")
sParam = spAddParameter(sParam, Me.EntityID, "Number")
spReturnProcedure sSQL & sParam & ", 2"
qryName = "spExecute"
Dim rpt As Access.Report
Dim prtr As Access.Printer
Set Application.Printer = Nothing
Set prtr = Application.Printer
prtr.Orientation = acPRORLandscape

DoCmd.OpenReport "rInvoiceDetailSearchDetails", acViewPreview, qryName
Set rpt = Reports("rInvoiceDetailSearchDetails")
Set rpt.Printer = prtr


'**********************************************************************

Exit_Routine:
On Error Resume Next
gError.HandleError
Exit Sub

Err_Routine:
gError.SetError Err, smodule, sRoutine
Resume Exit_Routine

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top