Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print the criteria for a date range in the report header

Status
Not open for further replies.

Mordacia

Technical User
Jan 24, 2002
13
US
I have created a report whose record source is a parameter query. The report opens from a command button on a form.
When the report opens and the query runs, the "Enter Parameter Value" box appears and the user is asked to enter a start date and an end date for the range. I want the user-selected range to appear in the header of the report. I have been able to do this by inserting text boxes in the header with their Control Sources set to the parameters in the query.

My problem arises when the user selects a start date for which there is no data - i.e, the user selects Start Date 1/02/2002 and End Date 1/04/2002 when the earliest data in the table is 1/10/2002. How can I get the start and end dates chosen by the user to appear in the header even when there is no data that matches the selection?
 
On the form (where the command button is, olace two text boxes. Set the command buttom to Enabled = No in the design mode. Have the users enter the dates in the text boxes. Validate the dates (Start < End, Both are VALID dates {usually within a range, like 1990 and <= Now}). When the dates are both validated, enable the command button. Use the content of the Form's text boxes as the control source for the report.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
MichaelRed,

I had the same problem and tried all steps from MichaelRed, but the &quot;Enter Parameter Value&quot; box for &quot;start date&quot; still popups after I hit the command button. If I enter start date in the popup box, the report will be printed showing the start date that I entered and the end with #error. Can someone help?

Thank for any help!
Lessica
 
It would appear that the parameter(s) for the query are not referencing the textbox(es) on the form. That would explain the pop-up(s) for the date parameters.

The #error has to do with the text box itself, and the value(e) entered.

It is not clear from your post if you are using both a start date and an end date and the end date is working or you have JUST the start date. If you are using BOTH, look at the Sen date part and see where the differences are. Otherwise, the issue is probably just how you are using / implementing the value in the single text box.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
If I understand you correctly, you are using the query to generate the input boxes. An alternative is to design a small form with two unbound fields into which to enter your date ranges, and then pass the values entered into the controls to a variable. Then format the query to obtain the date values from the variables.

In the report, you can then code controls to display the values obtained from the two unbound boxes as well.

Using this method, it should not matter whether or not data exists for the date range.

See this thread for details:

thread703-234319
 
In the parameter query you should have something like [Enter Start Date] and [Enter End Date]

Use these two values in your report header e.g.
assume the report heading as below&quot;
REPORTING PERIOD [Enter Start Date]TO [Enter End Date]

You should be able to get both the dates in your report. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top