|
 |
access thread: Close Report - No Data
Message #1 by "Maha Arupputhan Pappan" <mahap@p...> on Wed, 20 Feb 2002 03:27:01
|
|
Hi all,
My report retrieves data from a Query. I wish to close the report once the
query no data. I inserted the following code in the "On No Data" event:
Dim ErrorMsg, Title
ErrorMsg = "No data report."
Title = "No Data..."
MsgBox ErrorMsg, vbInformation, Title
Docmd.Close acReport, "Report Name"
However, when press the OK button I get this message:
Run-time error '2585':
This action can't be carried out while processing a form or report event.
<Continue> <End> <Debug> <Help>
<Continue> button is disabled.
Please help. Your assistance is much appreciated.
Thanks,
Maha
Message #2 by John Fejsa <John.Fejsa@h...> on Wed, 20 Feb 2002 15:23:12 +1100
|
|
Try this procedure.
Private Sub Report_NoData(Cancel As Integer)
On Error GoTo Err_Report_NoData
Beep
MsgBox "The report has no data." _
& "@Printing the report is canceled. " _
& "@Check the source of data for the report to make sure you " _
& "entered the correct criteria (for example, a valid range " _
& "of dates).", vbOKOnly + vbInformation
Cancel =3D True
Exit_Report_NoData:
Exit Sub
Err_Report_NoData:
MsgBox Error$, vbCritical, "Error Processing Report _NoData Procedure!"
Resume Exit_Report_NoData
End Sub
____________________________________________________
John Fejsa
Systems Analyst/Computer Programmer
Hunter Centre for Health Advancement
Locked Bag 10, WALLSEND NSW 2287
Phone: (02) 4924 6336 Fax: (02) 4924 6209
www.hcha.org.au
____________________________________________________
The doors we open and close each day decide the lives we live
____________________________________________________
CONFIDENTIALITY & PRIVILEGE NOTICE
The information contained in this email message is intended for the named
addressee only. If you are not the intended recipient you must not copy,
distribute, take any action reliant on, or disclose any details of the
information in this email to any other person or organisation. If you
have received this email in error please notify us immediately.
>>> mahap@p... 20/02/2002 14:27:01 >>>
Hi all,
My report retrieves data from a Query. I wish to close the report once
the
query no data. I inserted the following code in the "On No Data" event:
Dim ErrorMsg, Title
ErrorMsg =3D "No data report."
Title =3D "No Data..."
MsgBox ErrorMsg, vbInformation, Title
Docmd.Close acReport, "Report Name"
However, when press the OK button I get this message:
Run-time error '2585':
This action can't be carried out while processing a form or report event.
<Continue> <End> <Debug> <Help>
<Continue> button is disabled.
Please help. Your assistance is much appreciated.
Thanks,
Maha
This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient,
please delete it and notify the sender. Views expressed in this message are those of the individual sender, and are not necessarily
the views of Hunter Health.
Message #3 by "Maha Arupputhan Pappan" <mahap@p...> on Thu, 21 Feb 2002 01:33:04
|
|
> Try this procedure.
>
> Private Sub Report_NoData(Cancel As Integer)
> On Error GoTo Err_Report_NoData
>
> Beep
> MsgBox "The report has no data." _
> & "@Printing the report is canceled. " _
> & "@Check the source of data for the report to make sure you " _
> & "entered the correct criteria (for example, a valid range " _
> & "of dates).", vbOKOnly + vbInformation
> Cancel =3D True
>
> Exit_Report_NoData:
> Exit Sub
>
> Err_Report_NoData:
> MsgBox Error$, vbCritical, "Error Processing Report _NoData
Procedure!"
>
> Resume Exit_Report_NoData
> End Sub
>
>
> ____________________________________________________
>
> John Fejsa
> Systems Analyst/Computer Programmer
> Hunter Centre for Health Advancement
> Locked Bag 10, WALLSEND NSW 2287
> Phone: (02) 4924 6336 Fax: (02) 4924 6209
> www.hcha.org.au
> ____________________________________________________
>
> The doors we open and close each day decide the lives we live
> ____________________________________________________
>
> CONFIDENTIALITY & PRIVILEGE NOTICE
> The information contained in this email message is intended for the
named
> addressee only. If you are not the intended recipient you must not
copy,
> distribute, take any action reliant on, or disclose any details of the
> information in this email to any other person or organisation. If you
> have received this email in error please notify us immediately.
>
> >>> mahap@p... 20/02/2002 14:27:01 >>>
> Hi all,
>
> My report retrieves data from a Query. I wish to close the report once
> the
> query no data. I inserted the following code in the "On No Data" event:
>
> Dim ErrorMsg, Title
> ErrorMsg =3D "No data report."
> Title =3D "No Data..."
> MsgBox ErrorMsg, vbInformation, Title
> Docmd.Close acReport, "Report Name"
>
> However, when press the OK button I get this message:
> Run-time error '2585':
>
> This action can't be carried out while processing a form or report event.
>
> <Continue> <End> <Debug> <Help>
>
> <Continue> button is disabled.
>
> Please help. Your assistance is much appreciated.
>
> Thanks,
> Maha
>
> This message is intended for the addressee named and may contain
confidential information. If you are not the intended recipient, please
delete it and notify the sender. Views expressed in this message are those
of the individual sender, and are not necessarily the views of Hunter
Health.
>
Hey John,
Good day. Thank you very much for your assistance. I just need your final
touch to it. Once the I click the OK button in the Error Message Box, how
can I immediately close the report preview screen without even displaying
it. I think this code my place in the Cancel line.
I tried your command line CANCEL =3D TRUE, it just don't work.
Thanks,
Maha
Message #4 by John Fejsa <John.Fejsa@h...> on Thu, 21 Feb 2002 15:23:00 +1100
|
|
I'm not sure why it does not work for you. When I click on the button to
open a report with no data, I only get the error message telling me there
is no data. When I click on the OK button the error message disapears.
The report never opens at all so I don't have to close it.
1) Did you copy the procedure I've sent to your Report_NoData procedure.
2) Did you change anything?
3) Are you by any chance using Unbound report. This procedure will work
with Bound reports only. Unbound reports will never have data anyway.
4) It should work with all bound reports...
John
>>> mahap@p... 21/02/2002 12:33:04 >>>
> Try this procedure.=3D20
>
> Private Sub Report_NoData(Cancel As Integer)
> On Error GoTo Err_Report_NoData
>
> Beep
> MsgBox "The report has no data." _
> & "@Printing the report is canceled. " _
> & "@Check the source of data for the report to make sure you " _
> & "entered the correct criteria (for example, a valid range " _
> & "of dates).", vbOKOnly + vbInformation
> Cancel =3D3D True
> =3D20
> Exit_Report_NoData:
> Exit Sub
>
> Err_Report_NoData:
> MsgBox Error$, vbCritical, "Error Processing Report _NoData
Procedure!"=3D
>
> Resume Exit_Report_NoData
> End Sub
>
>
> ____________________________________________________
>
> John Fejsa
> Systems Analyst/Computer Programmer
> Hunter Centre for Health Advancement
> Locked Bag 10, WALLSEND NSW 2287
> Phone: (02) 4924 6336 Fax: (02) 4924 6209
> www.hcha.org.au
> ____________________________________________________
>
> The doors we open and close each day decide the lives we live
> ____________________________________________________
>
> CONFIDENTIALITY & PRIVILEGE NOTICE
> The information contained in this email message is intended for the
named =3D
> addressee only. If you are not the intended recipient you must not
copy, =3D
> distribute, take any action reliant on, or disclose any details of the
=3D
> information in this email to any other person or organisation. If you
=3D
> have received this email in error please notify us immediately.
>
> >>> mahap@p... 20/02/2002 14:27:01 >>>
> Hi all,
>
> My report retrieves data from a Query. I wish to close the report once
=3D
> the=3D20
> query no data. I inserted the following code in the "On No Data" event:
>
> Dim ErrorMsg, Title
> ErrorMsg =3D3D "No data report."
> Title =3D3D "No Data..."
> MsgBox ErrorMsg, vbInformation, Title
> Docmd.Close acReport, "Report Name"
>
> However, when press the OK button I get this message:
> Run-time error '2585':
>
> This action can't be carried out while processing a form or report
event.
>
> <Continue> <End> <Debug> <Help>
>
> <Continue> button is disabled.
>
> Please help. Your assistance is much appreciated.
>
> Thanks,
> Maha
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or=3D20
>
> This message is intended for the addressee named and may contain
confidential information. If you are not the intended recipient, please
delete it and notify the sender. Views expressed in this message are
those
of the individual sender, and are not necessarily the views of Hunter
Health.
>
Hey John,
Good day. Thank you very much for your assistance. I just need your
final
touch to it. Once the I click the OK button in the Error Message Box,
how
can I immediately close the report preview screen without even displaying
it. I think this code my place in the Cancel line.
I tried your command line CANCEL =3D3D TRUE, it just don't work.
Thanks,
Maha
This message is intended for the addressee named and may contain confidential information. If you are not the intended recipient,
please delete it and notify the sender. Views expressed in this message are those of the individual sender, and are not necessarily
the views of Hunter Health.
|
|
 |