Date Criteria on Query

X

xx

i have a report with query1 as record source.
the record source of my query1 are queries...

on the query1 criteria, it was set to accept input from
the user.

i put
=["Input Date to Print"]

it works fine... (if i wanted to print the date keyed in
and beyond....

my problem is, and what i really wanted to do is to select
only the dates matching the date the user keyed in.

when i remove the greater than sign from the criteria, the
query1 is getting 0 records..

heres a sample....
table:
07/14/2004
07/15/2004
07/15/2004

using >=["input date"] query criteria:

if the user key in july 15...its ok (shows only july 15ths)
it the user key in july 14... its ok ( shows july 14th and
15ths)

if i use =["input ....."]
= 0 records

can you please help me on this???

TIA
 
W

Wayne Morgan

Does the field have time in it as well as a date? If you used Now() to fill
it instead of Date() it probably does. When you type in just the date, the
time portion is 0, which is midnight. Therefore, almost none of your entries
will be equal to the date you typed in because they will all be later in the
day.

Try
=[Input Date to Print] And <[Input Date to Print] + 1

This will make it on or after the date entered and before the next day. To
get this to work, I had to specify the parameter as a DateTime type.

PARAMETERS [Input Date to Print] DateTime;
SELECT Table2.Field2
FROM Table2
WHERE (((Table2.Field2)>=[Input Date to Print] And (Table2.Field2)<[Input
Date to Print]+1));

--
Wayne Morgan
MS Access MVP


xx said:
i have a report with query1 as record source.

the record source of my query1 are queries...

on the query1 criteria, it was set to accept input from
the user.

i put
=["Input Date to Print"]

it works fine... (if i wanted to print the date keyed in
and beyond....

my problem is, and what i really wanted to do is to select
only the dates matching the date the user keyed in.

when i remove the greater than sign from the criteria, the
query1 is getting 0 records..

heres a sample....
table:
07/14/2004
07/15/2004
07/15/2004

using >=["input date"] query criteria:

if the user key in july 15...its ok (shows only july 15ths)
it the user key in july 14... its ok ( shows july 14th and
15ths)

if i use =["input ....."]
= 0 records

can you please help me on this???

TIA
 
Top