A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Cancel report with no record.



 
 
Thread Tools Display Modes
  #1  
Old May 22nd, 2004, 11:06 PM
Stephen
external usenet poster
 
Posts: n/a
Default Cancel report with no record.


Hi.

Can anyone tell me how to cancel report if there is no record? I don't like to see a report with error on record fields.

Thank you for your time.
  #2  
Old May 22nd, 2004, 11:29 PM
tina
external usenet poster
 
Posts: n/a
Default Cancel report with no record.

add the following event procedure to the report's module, as

Private Sub Report_NoData(Cancel As Integer)

Cancel = True
MsgBox "Request cancelled - no data available."

End Sub

hth


"Stephen" wrote in message
...

Hi.

Can anyone tell me how to cancel report if there is no record? I don't

like to see a report with error on record fields.

Thank you for your time.



  #3  
Old May 23rd, 2004, 12:10 AM
Ken Snell
external usenet poster
 
Posts: n/a
Default Cancel report with no record.

Also note that, if you're opening the report from a macro or VBA code, Error
2501 will be returned by the report to the procedure that opened the report.
If you don't want to see the ACCESS warning "The previous action has been
canceled.", you'll need to trap for this error and stop the error message
from appearing.

E.g.,

DoCmd.OpenReport "ReportName"
If Err.Number 2501 And Err.Number 0 Then
MsgBox "Error occurred"
End If


--
Ken Snell
MS ACCESS MVP

"tina" wrote in message
...
add the following event procedure to the report's module, as

Private Sub Report_NoData(Cancel As Integer)

Cancel = True
MsgBox "Request cancelled - no data available."

End Sub

hth


"Stephen" wrote in message
...

Hi.

Can anyone tell me how to cancel report if there is no record? I don't

like to see a report with error on record fields.

Thank you for your time.





  #4  
Old May 23rd, 2004, 05:02 AM
tina
external usenet poster
 
Posts: n/a
Default Cancel report with no record.

oops, forgot that not-so-minor point. thanks for picking up the slack, Ken!



"Ken Snell" wrote in message
...
Also note that, if you're opening the report from a macro or VBA code,

Error
2501 will be returned by the report to the procedure that opened the

report.
If you don't want to see the ACCESS warning "The previous action has been
canceled.", you'll need to trap for this error and stop the error message
from appearing.

E.g.,

DoCmd.OpenReport "ReportName"
If Err.Number 2501 And Err.Number 0 Then
MsgBox "Error occurred"
End If


--
Ken Snell
MS ACCESS MVP

"tina" wrote in message
...
add the following event procedure to the report's module, as

Private Sub Report_NoData(Cancel As Integer)

Cancel = True
MsgBox "Request cancelled - no data available."

End Sub

hth


"Stephen" wrote in message
...

Hi.

Can anyone tell me how to cancel report if there is no record? I

don't
like to see a report with error on record fields.

Thank you for your time.







  #5  
Old May 23rd, 2004, 06:45 AM
Ken Snell
external usenet poster
 
Posts: n/a
Default Cancel report with no record.

"tina" wrote in message
...
oops, forgot that not-so-minor point. thanks for picking up the slack,

Ken!


:-)

--
Ken Snell
MS ACCESS MVP



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:04 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.