Querying records between two dates

G

Guest

I need to query all records that fall between two dates. I have a column
where I input dates the record was input. This column is called "DATE INPUT"
and it is a short date format.

The expression criteria listed under "DATE INPUT" is:
=[ENTER START DATE] <DateAdd("d",1,[ENTER END DATE])

When I run the query, it pulls all records that have a date regardless of
whether it falls into that range.

What is going on? How do I fix it?
 
R

RBear3

why not use...

Between [Enter Start Date] and [Enter End Date]



--
Hope that helps!

RBear3
..

MEAD5432 said:
I need to query all records that fall between two dates. I have a column
where I input dates the record was input. This column is called "DATE
INPUT"
and it is a short date format.

The expression criteria listed under "DATE INPUT" is:
=[ENTER START DATE] <DateAdd("d",1,[ENTER END DATE])

When I run the query, it pulls all records that have a date regardless of
whether it falls into that range.

What is going on? How do I fix it?
 
G

Guest

AWESOME! That works perfectly. I guess Ockham's Razor works for database
queries...

Thanks.

RBear3 said:
why not use...

Between [Enter Start Date] and [Enter End Date]



--
Hope that helps!

RBear3
..

MEAD5432 said:
I need to query all records that fall between two dates. I have a column
where I input dates the record was input. This column is called "DATE
INPUT"
and it is a short date format.

The expression criteria listed under "DATE INPUT" is:
=[ENTER START DATE] <DateAdd("d",1,[ENTER END DATE])

When I run the query, it pulls all records that have a date regardless of
whether it falls into that range.

What is going on? How do I fix it?
 
J

John W. Vinson

I need to query all records that fall between two dates. I have a column
where I input dates the record was input. This column is called "DATE INPUT"
and it is a short date format.

The expression criteria listed under "DATE INPUT" is:
=[ENTER START DATE] <DateAdd("d",1,[ENTER END DATE])

When I run the query, it pulls all records that have a date regardless of
whether it falls into that range.

What is going on? How do I fix it?

You're finding all records where the value of the expression

[DATE INPUT] >= [ENTER START DATE]

is less than the expression

DateAdd("d",1,[ENTER END DATE])

Since the first expression will be either TRUE (-1) or FALSE (0), and the
second expression will be a large number (a date in the 21st century), this
will return all records.

You need to use
= [ENTER START DATE] AND < DateAdd("d",1,[ENTER END DATE])

to apply two criteria - and use the logical operator AND to select records
only where both criteria are True.

John W. Vinson [MVP]
 

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

Top