By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,688 Members | 1,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,688 IT Pros & Developers. It's quick & easy.

report error

P: n/a
Hi
I have a report with 3 subreports where from I take a few value in VBA
On Print event. Some value causes error so i wrote in my procedure
such code:

On Error GoTo err_bl
err_bl:
If Err = 3071 Then
MsgBox "Report contains wrong value!"
Exit Sub
End If

After error I got a msgbox and procedure is ending but report is
opening next.
How to do so that after appearing msgbox report will not open?
Is it possible?

Thanks for any help

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
to**@wp.pl wrote:
Hi
I have a report with 3 subreports where from I take a few value in VBA
On Print event. Some value causes error so i wrote in my procedure
such code:

On Error GoTo err_bl
err_bl:
If Err = 3071 Then
MsgBox "Report contains wrong value!"
Exit Sub
End If

After error I got a msgbox and procedure is ending but report is
opening next.
How to do so that after appearing msgbox report will not open?
Is it possible?

Thanks for any help

I tried to close a report via Docmd.Close and couldn't. Maybe it can be
done, maybe not. Briefly looked in GoogleGroups, but didn't see
anything there either.

Why don't you correct the problem? You could display a messagebox on
the the ID that it blows up on. Then do a
Docmd.OpenReport "YourReport",,,"ID = 123"
and correct it. Start looking in the tables for the data in id 123.
Run the query for the report for ID = 123".

I would suggest that it is your query that is the root of the problem.

You should know what is causing the error so you can trap for it for all
records. Providing a report that may or may not work for users is a bit
useless.
Nov 13 '05 #2

P: n/a
<< I would suggest that it is your query that <<is the root of the
problem.

<< You should know what is causing the <<error so you can trap for it
for all
<< records.

With this report it is a little difficult because I have there three
subreports and every subreport have his own independent query
and I open this report directly with DoCmn.OpenReport from my form but
I will try
Thanks for advice
Piter

Nov 13 '05 #3

P: n/a
to**@wp.pl wrote:
<< I would suggest that it is your query that <<is the root of the
problem.

<< You should know what is causing the <<error so you can trap for it
for all
<< records.

With this report it is a little difficult because I have there three
subreports and every subreport have his own independent query
and I open this report directly with DoCmn.OpenReport from my form but
I will try
Thanks for advice
Piter

If you can get to a single record...one that blows up...then run the SQL
for each report for that record...you will find the problem. Each
subreport is linked on some sort of key. So if the ID is 123, run the
main report recordwource for ID = 123 and do the same for all the
subreports. You should be able to run this from the report while in
design mode if the row source is a Select statement, not a table/query name.
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.