Printing multiple reports (1 Viewer)

linskill

Registered User.
Local time
Today, 22:41
Joined
Nov 1, 2012
Messages
38
Hi All,
I am trying to print a set of reports using one button. Everything works fine as long as all the reports are not blank. Unfortunately not all of the forms are used in all cases and it all comes crashing down when no ApptID is found. I have tried the "On No Data" but that just stops the job. I feel a IF THEN is needed but with my limited knowledge I cant work out how to do it. Can anyone point me in the right direction?
 

Attachments

  • Ashampoo_Snap_Thursday, 18 May 2023_15h6m16s.png
    Ashampoo_Snap_Thursday, 18 May 2023_15h6m16s.png
    29 KB · Views: 75

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:41
Joined
Feb 19, 2002
Messages
43,385
You need to add error trapping to the code. PS - when you post code, DO NOT post pictures of the code. Post the actual code. There is nothing we can do with a picture.
Code:
On Error Goto ErrProc
''''your existing code goes here

ExitProc:
    Exit Sub
ErrProc:
    Select Case Err.Number
        Case 2501
            Resume Next
        Case Else
            Msgbox Err.Number & " -- " & Err.Description
    End Select
    Resume ExitProc

I assumed you were getting error 2501. If you are getting a different error, just add it to the case statement.
 

linskill

Registered User.
Local time
Today, 22:41
Joined
Nov 1, 2012
Messages
38
You need to add error trapping to the code. PS - when you post code, DO NOT post pictures of the code. Post the actual code. There is nothing we can do with a picture.
Code:
On Error Goto ErrProc
''''your existing code goes here

ExitProc:
    Exit Sub
ErrProc:
    Select Case Err.Number
        Case 2501
            Resume Next
        Case Else
            Msgbox Err.Number & " -- " & Err.Description
    End Select
    Resume ExitProc

I assumed you were getting error 2501. If you are getting a different error, just add it to the case statement.
You sir are an absolute genius, thank you very much that was exactly what i needed.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:41
Joined
Feb 28, 2001
Messages
27,253
@linskill - she's pretty tolerant, but FYI, Pat Hartman is a Ma'am, not a Sir. She is one of our treasured members.
 

Users who are viewing this thread

Top Bottom