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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date from Query

Status
Not open for further replies.

RandyMcI

Technical User
Jul 7, 2001
5
CA
I have a report that is based on a query that contains a between statement on a date field.

How can I trap the Start date and End date that the user enters on the query and print the print the 2 dates on the report.

Thank you

Randy

 
Randy
I assume you have parameters in your query that call for the user to enter the Between [start date] And [end date].

In your report header, put an unbound text box that would be something such as the following

=This report covers information between " & [start date] & "and " & [end date]

Hope that helps.

Tom
 
Hi

How are you getting the user to enter the dates?, with [From Date] type criteria?

Usual way to do this is to use a form to request the dates, include a button to run the report

in the query use Forms!MyForm!FromDate to syntax in the query, you can also include a tect box control in the report with source =Forms!MyForm!FromDate

you need to use your own form and control names of course



Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Randy
Ken is absolutely right that a good way to call your dates is from a form. I was just providing you with a quick way to do it from the query.

I also wanted to mention that, for some reason, when my post was submitted the quotation mark (") at the beginning of my text box statement was removed. There should be " between the = sign and This.

I'll type it again and see if the " is removed again.

="This report covers information between " & [start date] & "and " & [end date]

Tom
 
Thank's Ken, worked like a charm.

I also tried Tom's method. But it asked me twice for the dates.

Randy
 
Randy
Glad that Ken's method worked. That's the important thing. And as I indicated earlier, the "query by form" method is better anyway.

As for being asked twice for the paremeters, the only time I have been asked twice is when I haven't called the parameters exactly the same in the report as I did in the query. It only takes a single character difference to cause it to happen.

Tom
 
Tom,

Your reply makes sense, as I cut and pasted your exact line from above, without changing to match what I had put in my query.

Thank you

Randy
 
Randy
Aha! The old cut and paste method. That'll confuse even Access!

Good catch.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top