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

Saving Query Criteria for a Report

Status
Not open for further replies.

tbohon

Programmer
Apr 20, 2000
293
US
In Access 97 I have a parameterized query which gets two dates with a report being produced from the query showing only records between those two dates.<br><br>What I need to do is print those dates on the report - but I can't figure out how to pass those parameter values from the query to the report.<br><br>Any suggestions GRATEFULLY accepted!<br><br>TIA,<br>Tom
 
Hi Tom,<br><br>Here is one method to consider.<br><br>Make a form with two text fields.&nbsp;&nbsp;Name them StartDate and EndDate.&nbsp;&nbsp;Reference the query to the form:<br><br>in the query grid, date field criteria type:<br><br>Between forms!YourForm!StartDate and forms!Yourform!EndDate<br><br>Now for the report.&nbsp;&nbsp;Add a button to the form that brings up the report.&nbsp;&nbsp;Have the report reference the StartDate and EndDate fields on the form.&nbsp;&nbsp;&nbsp;ie<br><br>2 text boxes on the report:&nbsp;&nbsp;StartDate, EndDate<br><br>in the Source field type:&nbsp;&nbsp;forms!YourForm!StartDate and Forms!Yourform!EndDate.<br><br>Hope that helps.<br><br>Jim
 
Here is another method if you don't want to reference the form.<br><br>Enter this in a text box on the report header or page header.<br><br>=&quot;Date Range: &quot; & DMin(&quot;Date&quot;,&quot;Query1&quot;) & &quot; - &quot; & DMax(&quot;Date&quot;,&quot;Query1&quot;)<br><br>substitute Query1 for the name of the query your report is based on.<br><br>You can change the items between quotes &quot;&quot; to what ever you desire.&nbsp;&nbsp;&quot;Date Range&quot;&nbsp;&nbsp;&quot; - &quot; <br><br>
 
I KNEW it would be simple ... I just got headed down the wrong track in the crush of 'you gotta get this done yesterday if possible' ...<br><br>I'll give it a shot in the morning - I'm not dedicated enough to drive back into town tonight.<br><br>Thanks!<br><br>Tom
 
put this in a text box on the report<br>=&quot;Criteria dates between&nbsp;&nbsp;&quot; & [Enter first date] & &quot; and&nbsp;&nbsp;&quot; & [Enter last date]<br><br>In query the date criteria should be, between [Enter first date] and [Enter last date]<br><br>the problem with dmin and dmax if you set the criteria for say 5/31/2000 and the oldest record is 5/30/2000 the report won't reflect the true criteria requested.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top