Solved

Closing a report Error "This action can't be carried out while processing a form or report event"

Posted on 2001-07-02
19
1,525 Views
Last Modified: 2007-12-19
If not data then I messagebox and I am trying to do a DoCmd.Close and I get this error.  How do I stop the processing and allow this to close.  It is a report.
0
Comment
Question by:bostonroxx
19 Comments
 
LVL 6

Expert Comment

by:cjswimmer
Comment Utility
in the NoData Event of the report, just set Cancel = True
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
i would add that u trap the error that will be caused by the Cancel = True statement.

the on click event of the button with which u open the report (i assume a button is used, but u can use this also if u use e.g. a combobox' after update event):


Private Sub cmdOpenReport_Click()
On Error GoTo ErrHandler
 
    DoCmd.OpenReport "YourReport", acPreview

ErrHandler:
    If Err.Number = 2501 Then
        Err.Clear
        MsgBox "The report has no data..."
    End If
   
End Sub

cheers
Ricky
0
 

Author Comment

by:bostonroxx
Comment Utility
I tried using the Cancel = True after the message box but this did not stop the processing.
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
hi bostonroxx,

exactly what code are u running?

can u show here the code in the report and the code u use in the form?

I feel we need more info to be able to assist u better.

Ricky
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
are u still having problems with this one bostonroxx ?
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
any update bosonroxx?
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
Hi bostonroxx,

u been asking 8 Q's in 10 days, and have not graded 1.
Didn't anyone provide a correct comment?

u should follow up on your Q's. Experts put in time and effort for u, u know!

cheers
Ricky
0
 
LVL 6

Expert Comment

by:cjswimmer
Comment Utility
bostonroxx,  the messagebox function you showed was outside the scope of the report.  You need to put

   Cancel=True

inside the NoData() Event on the actual Report.

0
 
LVL 6

Expert Comment

by:cjswimmer
Comment Utility
and take out the DoCmd.Close
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 6

Expert Comment

by:cjswimmer
Comment Utility
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
this is a waste of time,
grab the answer and run off without even a thanx...

added to BL.

cheers
Ricky
0
 
LVL 12

Accepted Solution

by:
Paurths earned 50 total points
Comment Utility
complete procedure on Date: 07/02/2001 10:45AM PST

worked a zillion times when testing it. It would be amazing if it would not work on another comp:

<
i would add that u trap the error that will be caused by the Cancel = True statement.


Private Sub Report_NoData(Cancel As Integer)
Cancel = True
End Sub


the on click event of the button with which u open the report (i assume a button is used, but u can
use this also if u use e.g. a combobox' after update event):


Private Sub cmdOpenReport_Click()
On Error GoTo ErrHandler

   DoCmd.OpenReport "YourReport", acPreview

ErrHandler:
   If Err.Number = 2501 Then
       Err.Clear
       MsgBox "The report has no data..."
   End If
   
End Sub

cheers
Ricky
>
0
 

Expert Comment

by:costello
Comment Utility
Force accepting Paurths' comment.

costello
Community Support Moderator @ Experts-Exchange
0
 
LVL 6

Expert Comment

by:cjswimmer
Comment Utility
costello, can you please post the explanation as to why you accepted Paurths answer over mine?
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
b/c u were on honeymoon ... ?

:-)
cheers
0
 
LVL 6

Expert Comment

by:cjswimmer
Comment Utility
heh heh....probably...I looked over the posts again and agree that Paurths should get the points.
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
djeez, cjswimmer,

where do u live (aka : keep track of EE) ???
0
 
LVL 6

Expert Comment

by:cjswimmer
Comment Utility
Connecticut, USA
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
ah, i see

(was just to check b/c it was pretty late here (Belgium) when i posted, but i guess it was a respectable time over there...)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now