Report with No data Input

G

Greg

I have written a query that normally produces records for a report. I have
used the "Report Wizard" to create the report. I have manually added two
"things " to the report.
The first is a label in the Page Header of the report that says "no data"
with its visibility attribute set to no. When the underlying query produces
no data, I added an event procedure at the ON NO DATA property. This event
procedure simply turns the visibility property to yes so my "no data "
label is displayed.
So far all works well with and without data.

The second "thing" I manually added does not work so well. I have added a
text box to the report header section of the report. This text box asks me
for a report date and is placed on the report. This works well when the
underlying query produces records for the report. However if there are no
records for the report the text box produces a " #error " indicator. The
report asks me for the report date but displays the error indicator.

I want the report date to always appear wither there is data for the report
or not!
Can anyone tell me what I am doing wrong or give me some suggestions on how
to get my report date to display when no underlying data is present??
 
M

Marshall Barton

Greg said:
I have written a query that normally produces records for a report. I have
used the "Report Wizard" to create the report. I have manually added two
"things " to the report.
The first is a label in the Page Header of the report that says "no data"
with its visibility attribute set to no. When the underlying query produces
no data, I added an event procedure at the ON NO DATA property. This event
procedure simply turns the visibility property to yes so my "no data "
label is displayed.
So far all works well with and without data.

The second "thing" I manually added does not work so well. I have added a
text box to the report header section of the report. This text box asks me
for a report date and is placed on the report. This works well when the
underlying query produces records for the report. However if there are no
records for the report the text box produces a " #error " indicator. The
report asks me for the report date but displays the error indicator.

I want the report date to always appear wither there is data for the report
or not!


You should follow the usual recommended design and use a
form with a text box for users to enter the date and a
button to open the report. This way the report can refer to
the form text box instead of using a prompt string.
 
G

Greg

Marsh,

Thank You,

I am new at this and am muddling my way through.

If you could let me know where I can find "the usual recommended design and
use a
form with a text box" I would sincerely appreciate the information. If you
could just give me to a reference regarding "recommended design" I will try
to take it from there.
Also, I am not really trying to create this report for a user. I need to
personally do some analysis of information and I file some of these reports
(hardcopy)for some auditors.

Thank You,
Greg
 
F

fredg

Marsh,

Thank You,

I am new at this and am muddling my way through.

If you could let me know where I can find "the usual recommended design and
use a
could just give me to a reference regarding "recommended design" I will try
to take it from there.
Also, I am not really trying to create this report for a user. I need to
personally do some analysis of information and I file some of these reports
(hardcopy)for some auditors.

Thank You,
Greg

Here you go.

First, create a query that will display the fields you wish to show in
the report.

Second, create a report, using the query as it's record source, that
shows the data you wish to display for ALL records.

Let's assume it is a starting and ending date range you need as
criteria.

Next, make a new unbound form.

Add 2 unbound text controls to the form.
Set their Format property to a valid U.S. date format.
Name one "StartDate".
Name the other "EndDate".

Add a command button to the form.
Code the button's Click event:
Me.Visible = False
Name this form "ParamForm"

Go back to the query. As Criteria on the DateField, write:
Between forms!ParamForm!StartDate and forms!ParamForm!EndDate

Code the Report's Open Event:
DoCmd.OpenForm "ParamForm" , , , , , acDialog

Code the Report's Close event:
DoCmd.Close acForm, "ParamForm"

To show the starting and ending dates in the header of the report, add
an unbound control.
As it's control source, write:

="For sales between " & forms!ParamForm!StartDate & " and " &
forms!ParamForm!EndDate

Run the Report.
The report will open the form.

Enter the starting and ending dates into the form.
Click the command button.

The Report will display just those records selected.
The dates will print in the header.
When the Report closes it will close the form.

If there are no records in the report, the dates will still appear.
Code the Report's OnDoData event as you already have in your original
post to display your "No Records" label.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top