Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1805
  • Last Modified:

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

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
bostonroxx
Asked:
bostonroxx
1 Solution
 
cjswimmerCommented:
in the NoData Event of the report, just set Cancel = True
0
 
PaurthsCommented:
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
 
bostonroxxAuthor Commented:
I tried using the Cancel = True after the message box but this did not stop the processing.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
PaurthsCommented:
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
 
PaurthsCommented:
are u still having problems with this one bostonroxx ?
0
 
PaurthsCommented:
any update bosonroxx?
0
 
PaurthsCommented:
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
 
cjswimmerCommented:
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
 
cjswimmerCommented:
and take out the DoCmd.Close
0
 
PaurthsCommented:
this is a waste of time,
grab the answer and run off without even a thanx...

added to BL.

cheers
Ricky
0
 
PaurthsCommented:
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
 
costelloCommented:
Force accepting Paurths' comment.

costello
Community Support Moderator @ Experts-Exchange
0
 
cjswimmerCommented:
costello, can you please post the explanation as to why you accepted Paurths answer over mine?
0
 
PaurthsCommented:
b/c u were on honeymoon ... ?

:-)
cheers
0
 
cjswimmerCommented:
heh heh....probably...I looked over the posts again and agree that Paurths should get the points.
0
 
PaurthsCommented:
djeez, cjswimmer,

where do u live (aka : keep track of EE) ???
0
 
cjswimmerCommented:
Connecticut, USA
0
 
PaurthsCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now