Database stoped responding when a report fails to open?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • moonrb
    New Member
    • Nov 2013
    • 23

    Database stoped responding when a report fails to open?

    Hi,

    I have some reports in my database where i put the following VB code to display a No Data message.
    Code:
    Private Sub Report_NoData(Cancel As Integer)
        MsgBox "There is no data to display", _
               vbExclamation, _
               "No Records"
        Cancel = True
    End Sub
    The code works fine but after getting the Message "There is no data to display" The database stops responding.
    Can any one please explain me? why the database stops responding ?
    Please give me a solution.

    Thanks in advance.
    Last edited by NeoPa; Sep 16 '18, 04:53 PM. Reason: Added mandatory [CODE] tags.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32662

    #2
    Although I don't see why it would stop responding completely I suspect this is more about how little you've actually explained your problem.

    What I do know is that when you use the Cancel = True option from within your Report_NoData() event procedure the code that called the report to open is considered to have failed so the code would typically stop with an error prompt. That's always assuming you've set your VBIDE options sensibly though. See Debugging in VBA.

    Comment

    • moonrb
      New Member
      • Nov 2013
      • 23

      #3
      Dear Friend

      Thank you so much for your reply. Your given link helped me to solve the problem. I set to Break on All Errors in Tools / Options / General of VBA Window whereas it was set to Break on Unhandled Errors by default.

      Thank you again
      Moonrb

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32662

        #4
        Glad to help where I can MoonRB.

        Do be careful with what you've just said you've changed though - Break on All Errors is only appropriate for the development stage where you need to see every error, regardless of how you're handling it in the code.

        Break on Unhandled Errors, or even Break in Class Module if you're developing any class modules, is the appropriate setting for when you're running your project normally as a user.

        If you set this the wrong way you can get very frustrating errors popping up even when they're handled by the code - ostensibly.

        Comment

        Working...