Suppress popup when no data to print

H

homer

I have a batch print out job on a backend server. In order to run it
unattended, I need to suppress a popup message.
The popup was err 2501: The PrintOut action was Canceled, caused by
Report_NoData for certain page of the report in question.
I tried to trap the err in the following way, but it did not work.
Private Sub Report_NoDate(Cancel as integer)
Beep
Cancel=true
End Sub
Sub PrintReport()
On err goto errHandle:
....
DoCmd.PrintOut
....
errHandle:
If err.number =2501 then
resume next
end if

This is not working because when there is not data line DoCmd made the popup
shows, the errHandle never got a chance to catch it.

I also tried to eliminate the no data record from the underlying query
without any luck. Because when the query first runs, there is data. However,
during the long looping batch, some of the records got processed by other
transactions and the data nolonger there.

Any idea how I can suppress the popup programmatically so I don't have to
sit in the closet all day long clicking OK when the batch is running?

Thanks for the rescue!
 
D

DS

homer said:
I have a batch print out job on a backend server. In order to run it
unattended, I need to suppress a popup message.
The popup was err 2501: The PrintOut action was Canceled, caused by
Report_NoData for certain page of the report in question.
I tried to trap the err in the following way, but it did not work.
Private Sub Report_NoDate(Cancel as integer)
Beep
Cancel=true
End Sub
Sub PrintReport()
On err goto errHandle:
...
DoCmd.PrintOut
...
errHandle:
If err.number =2501 then
resume next
end if

This is not working because when there is not data line DoCmd made the popup
shows, the errHandle never got a chance to catch it.

I also tried to eliminate the no data record from the underlying query
without any luck. Because when the query first runs, there is data. However,
during the long looping batch, some of the records got processed by other
transactions and the data nolonger there.

Any idea how I can suppress the popup programmatically so I don't have to
sit in the closet all day long clicking OK when the batch is running?

Thanks for the rescue!
Try This

Private Sub Command148_Click()
On Error Resume Next
DoCmd.OpenReport "rptBar", acViewPrint
DoCmd.OpenReport "rptKitchenHot", acViewPrint
If Err = 2501 Then Err.Clear

End Sub

DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top