Report Header when no records found

C

Chris

I have a report that displays the values in a table that
was generated from a make-table query. The search
criteria for the query are entered by the user in a form.

The header of the report includes the search criteria from
the form.

When the search criteria result in records found, they are
properly shown in the report. The search criteria are
shown in the header.

However, if the search produced no results, the report
does not include the search criteria in the header. The
text box labels are there, but the actual criteria from
the form are not included. That results in a report that
shows no results found, but no indication of the search
criteria used.

Any ideas on how to display the search criteria in the
report, even if no records are found?

Thanks.
 
F

Fredg

Chris,
Instead of using something like:
Between [Enter Start Date] and [Enter End Date]
in the query, make a form for parameter entry (or add controls to an
existing form).
Control Name: StartDate
ControlName: EndDate

Code the query criteria:
Between forms!FormName!StartDate and forms!FormName!EndDate

Then in the report, add an unbound control to the Header:
= "For sales between " & forms!FormName!StartDate " & " and " &
forms!FormName!EndDate

The form must still be open when the report is run.
You can make it not visible.

If you wish, you can code the report's close event to also close the form:
DoCmd.Close acForm, "FormName"
 

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