Query date into Report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

From a Form I would like to enter a date range to pull from one single column
within my table labeled "Date". When clicking a button I would like to have
that date range opened to a report to preview/print. I have been unable to
figure this out after numerous hours of trying.

Thanks for the help!

Dave
 
From a Form I would like to enter a date range to pull from one single column
within my table labeled "Date". When clicking a button I would like to have
that date range opened to a report to preview/print. I have been unable to
figure this out after numerous hours of trying.

Thanks for the help!

Dave

Create an unbound form.
Add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

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

When ready to run the report, open the report.
The form will open and wait for the entry of the starting and ending
dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.


Do you really have a field named [Date]?
Date is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'
 

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

Back
Top