473,326 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

report errors

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
Piter

Nov 13 '05 #1
5 1500
See if this will do what you want. A line has been added to your code.
On Error GoTo err_bl
err_bl:
If Err = 3071 Then
MsgBox "Report contains wrong value!" DoCmd.Close acReport, Me.Name, acSaveNo Exit Sub
End If

--
Wayne Morgan
MS Access MVP
<to**@wp.pl> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com... 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
Piter

Nov 13 '05 #2
Thanks but report after that is still opening.
I think this is more complicated problem and I need to break in some
way On Print event. It is possible because when I didnt place error
code in procedure I got a standard error msgbox and when I click end
button report dont open. But how Microsoft programmers did it I dont
know.
Thanks anyway
Piter

Nov 13 '05 #3
Wayne Morgan wrote:
See if this will do what you want. A line has been added to your code.

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


DoCmd.Close acReport, Me.Name, acSaveNo
Exit Sub
End If


Hi Wayne. At least in A97, a Docmd.Close chokes in an OnPrint or
OnFormat event and informs me that I can't do that with the event is
running.

My suggestion to correct the problem.

To the original poster, see my response in the other thread you posted.

Nov 13 '05 #4
Salad's method is the best way. However, if you can't close the report in
the section's Print event, try the report's Error event to see if it is
receiving the error. It will depend on the type of error whether or not it
will be detected here. If it is, you may be able to close the report from
the Error event. Also, have the error handler in the Print event Cancel the
event by setting Cancel = True.

--
Wayne Morgan
MS Access MVP
<to**@wp.pl> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Thanks but report after that is still opening.
I think this is more complicated problem and I need to break in some
way On Print event. It is possible because when I didnt place error
code in procedure I got a standard error msgbox and when I click end
button report dont open. But how Microsoft programmers did it I dont
know.
Thanks anyway
Piter

Nov 13 '05 #5
Yes I have checked it befor Cancel = true is not working and error dont
appear in Error event so I think the Salad's method is the only method
:)
Thanks for all your answers
Piter

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: stemo76 | last post by:
I have created a report with subform/subreports. I can see all the data on the screen but when I try to print it to a printer or adobe distiller I get 'The Microsoft Jet Database engine could not...
2
by: Stephen Miller | last post by:
Can the CustomValidator be used to simply report unexpected errors, without requiring Client/Server validation? To explain, say you had a simple text box and button that did a Full-text Search of a...
5
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I get my browser to report javascript errors?...
8
by: sara | last post by:
Hi - I have looked at all posts and tried both Allen Browne's Report Sorting at run Time ( Select Case Forms!frmChooseSort!grpSort Case 1 'Name Me.GroupLevel(0).ControlSource = "LastName"...
4
by: lupo666 | last post by:
Hi everybody, this time I have three problems driving me nuts :-((( (1) I have a report with 20 or so Yes/No "squares". Is there a way to either hide/show the "square" or change the yes/no...
3
by: jasocke2 | last post by:
What I have, I think is quite a simple question, I have looked around for quite a while but can't seem to find the solution. What I have is a database with 1 table, the fields that I am...
1
by: adolph | last post by:
I generate a collection of errors from a procedure. I then show these errors in a msgbox buy looping thru the collection and adding them to a string called sMsg. in the msgbox, I ask the user if...
4
by: Phil Stanton | last post by:
I am opening a report (in Preview) from a menu system I use the following code if there is no data in a report Private Sub Report_NoData(Cancel As Integer) MsgBox "There are no errors in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.