423,335 Members | 1,149 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,335 IT Pros & Developers. It's quick & easy.

Database stoped responding when a report fails to open?

P: 23
Hi,

I have some reports in my database where i put the following VB code to display a No Data message.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_NoData(Cancel As Integer)
  2.     MsgBox "There is no data to display", _
  3.            vbExclamation, _
  4.            "No Records"
  5.     Cancel = True
  6. 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.
6 Days Ago #1

✓ answered by NeoPa

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.

Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,004
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.
5 Days Ago #2

P: 23
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
2 Days Ago #3

NeoPa
Expert Mod 15k+
P: 31,004
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.
1 Days ago #4

Post your reply

Sign in to post your reply or Sign up for a free account.