Date Ranges

  • Thread starter Thread starter Greta
  • Start date Start date
G

Greta

Access 2002...
I am trying to get a report to only include records with
in a certain date range. I have a form that will preview
the report when a button is pushed, but I only want the
records between a certain date range to appear.
My ideal would be that the date ranges would be entered
this form and when the button is pushed it uses that
criteria then previews the report showing only that date
range.
Help,
Thanks,
Greta
 
the easiest way would be to have a criteria like "Between
[Forms]![frmYourForm]![txtStartDate] And [Forms]!
[frmYourForm]![txtEndDate]" in the reports query. Then
make sure the user enters the date range before printing
the report. I use a pop up form with date range fields and
pass the name of the report to the form. That way I can
use the same pop up form for all reports.
 
One way is to base the report on a parameter query using
Between [Type the beginning date:] And [Type the ending
date:]

Roxie Aho
 
There are a couple of ways to do this,

1. you can get the user to enter in two dates into text
boxes on a form. then assign these values to a var the
build the SQL statement using the BETWEEN SQL statement.

OR

2. You can drop 2 activex calanders on the form and assign
them to var and use them to build your SQL statement.


for both these option you when you use the Docmd.open
report in the where section you will need to use an SQL
statement like this.

WHERE date(field) BETWEEN "#" & d1 & "#" & "AND" & "#" &
d2 & "#"

Hope this helps
 
Back
Top