Connecting Tech Pros Worldwide Forums | Help | Site Map

Display new report when chosen one contains no data...

Member
 
Join Date: Sep 2007
Posts: 94
#1: Mar 10 '08
I have a complicated report with numerous parameters which will on occasion return no records.

What i want to do is have a new report display when this happens which includes the company logo etc. stating something like "The parameters you have entered have returned no data, please try again."

I don't want to achieve this using a message box or any pop ups at all, due to the way my users are accessing the reports it will have to be a report which gives them the message.

I currently have in the no data property...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "BWRptNO_DATA", acViewPreview
which will open the new report but it does so behind the report with no data in.
Every time i try to insert a Close somewhere in the code....
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "BWRptNO_DATA", acViewPreview
  2. DoCmd.Close acReport, "BWrptAnalysisOfEnrolmentsByPostCode"
i get an error message saying "This action can't be carried out while processing a form or report event.

Can anyone help me?

Member
 
Join Date: Sep 2007
Posts: 94
#2: Mar 11 '08

re: Display new report when chosen one contains no data...


Fixed it.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_NoData(Cancel As Integer)
  2.     DoCmd.OpenReport "BWRptNO_DATA", acViewPrevie
  3.     DoCmd.CancelEvent
  4. End Sub
Reply