Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
1,713 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
19 Comments
 
LVL 6

Expert Comment

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

Expert Comment

by:Paurths
ID: 6245730
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
ID: 6245792
I tried using the Cancel = True after the message box but this did not stop the processing.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 12

Expert Comment

by:Paurths
ID: 6245894
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
ID: 6246545
are u still having problems with this one bostonroxx ?
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6267780
any update bosonroxx?
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6278087
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
ID: 6278124
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
ID: 6278132
and take out the DoCmd.Close
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6331550
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 200 total points
ID: 6386317
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
ID: 6403572
Force accepting Paurths' comment.

costello
Community Support Moderator @ Experts-Exchange
0
 
LVL 6

Expert Comment

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

Expert Comment

by:Paurths
ID: 6434776
b/c u were on honeymoon ... ?

:-)
cheers
0
 
LVL 6

Expert Comment

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

Expert Comment

by:Paurths
ID: 6434798
djeez, cjswimmer,

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

Expert Comment

by:cjswimmer
ID: 6436133
Connecticut, USA
0
 
LVL 12

Expert Comment

by:Paurths
ID: 6436149
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

704 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