Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    suppress message in Preview mode (2000 all updates)

    I have the following code on the Page event of a 2 page report. Page 2 is forced by a page break in the report.

    Private Sub Report_Page()
    If Me.Page > 1 Then
    Call MsgBox(" Please turn paper over" _
    & vbCrLf & "and press OK to print page 2." _
    , vbExclamation, "Pause printing")
    End If
    End Sub

    This does exactly what I want in Print mode. But I do not want the message box, and print to pause, in Preview mode.

    Is there code I can add to suppress the message box in Preview mode? Or different code I can use for this?

    Tom

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: suppress message in Preview mode (2000 all updates)

    You can add the following code to the report module:

    Private Printing As Integer

    Private Sub ReportHeaderSection_Print(Cancel As Integer, PrintCount As Integer)
    ' Occurs when previewing and when printing
    Printing = Printing + 1
    End Sub

    Private Sub Report_Activate()
    ' Occurs only when previewing
    Printing = -1
    End Sub

    Private Sub Report_Deactivate()
    ' Reset for next time
    Printing = 0
    End Sub

    Replace ReportHeaderSection with the name of the report header section. Note: your report must have a report header, and its height must be greater than 0. You don't need to put anything in the report header, however.

    Change the test in your Report_Page code to

    If Me.Page > 1 And Printing > 0 Then

  3. #3
    4 Star Lounger
    Join Date
    Oct 2003
    Location
    Guelph, Ontario, Canada
    Posts
    428
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: suppress message in Preview mode (2000 all updates)

    Hans
    Thanks so much. Works like a charm.

    Have a great and wonderful day !!

    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •