Re: View alternate report when first report is blank

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I was able to follow your suggestion and the report is working just great. I
really appreciate your help! Thanks!!
--
Judy B


"Jubu" wrote:

Thanks! Your second suggestion was just what I wanted. I had never
attempted this type of thing before and I appreciate the vb language to do
so! I'm working on this at a different building, so I will let you know in
another reply if there are any problems. But this looks like exactly what I
need.
--
Judy B


"fredg" wrote:

On Tue, 21 Feb 2006 17:56:27 -0800, Jubu wrote:

I am working on a database that reviews and reports shipping performance
issues. A report run via selected date range will show all orders that are
considered late, according to specific criteria. A subreport will show the
percentage of late vs. on time. The goal of course is to have the report
show 100% on time - with no records indicating lateness.

The problem: When the date range selected is such that no orders are late,
the report will come up with #error# in several text boxes and no
information. True, since no orders are late. However, I would like that
report to instead show "All Orders On Time" or have another report appear
that says the above statement.

I created a macro that would run in the report event property "On No Data"
which would pull up a second report with the label "All Orders On Time", but
the original report with #error# still comes up with it. I tried to modify
the macro, so that it would close the #error# report first and then pull up
the second report, but that would not work either.

Any ideas/suggestions?!

It's not clear whether you just want a message to alert the user that
there was no data or you want a printed copy of the report that says
there is no data.

To display just a message....
Code the report's OnNoData event:
MsgBox "There was no data in this time period."
Cancel = True

If this report has been opened from an event on a form, you must add
error handling to that form event to trap error 2501.


On Error Goto Err_Handler
DoCmd.OpenForm "FormName"
Exit_This_Sub:
Exit Sub
Err_Handler:
If Err = 2501 Then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End If
Resume Exit_This_Sub
End Sub

To actually print the report with a label that says there was no data,
add a label to the report header. Set it's caption to "No data for
this time period.".
Name it LabelNoData. Make it Not Visible.

Code the Report OnNoData event:

LabelNoData.Visible = True
OtherControlInReportHeader.Visible = False
etc.
Me.Section(0).Visible = False ' Detail Section
Me.Section(3).Visible = False ' Page Header
Me.Section(4).Visible = False ' Page Footer\
etc.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

.



Relevant Pages

  • Re: Judy Finnegan to quit television?
    ... Judy Finnegan is planning to give up television to become an author - ... leaving Richard Madeley to present alone, a report has claimed. ... I miss you, I'm not gonna crack ...
    (uk.media.tv.misc)
  • Re: Judy Finnegan to quit television?
    ... Judy Finnegan is planning to give up television to become an author - ... leaving Richard Madeley to present alone, a report has claimed. ...
    (uk.media.tv.misc)
  • Re: Judy Finnegan to quit television?
    ... Judy Finnegan is planning to give up television to become an author - ... leaving Richard Madeley to present alone, a report has claimed. ...
    (uk.media.tv.misc)
  • Judy Finnegan to quit television?
    ... Judy Finnegan is planning to give up television to become an author - ... leaving Richard Madeley to present alone, a report has claimed. ...
    (uk.media.tv.misc)
  • Re: Fields in Label dont give correct information
    ... tables where the data was stored in the query the query would not run. ... half the time with very few errors (other than that label problem I had.) ... report all of the information shows up on the report the way I want it to. ... For example in the Room assignment on the report an idividual will be ...
    (microsoft.public.access.reports)