Need query to find records between dates

T

Techhead

I have a table called RECORDS with 2 columns in date/time format
called STARTDATE and ENDDATE. I need to query all records where the
ENDDATE is 5 days or greater in difference after the STARTDATE. It's
been a while since I've used access and can'tg seem to figure this one
out.


Thanks,
Brian
 
T

Techhead

I have a table called RECORDS with 2 columns in date/time format
called STARTDATE and ENDDATE. I need to query all records where the
ENDDATE is 5 days or greater in difference after the STARTDATE. It's
been a while since I've used access and can'tg seem to figure this one
out.

Thanks,
Brian

I figured it out.

SELECT RECORDS.STARTDATE, RECORDS.ENDDATE
FROM RECORDS
WHERE ((([ENDDATE]-[STARTDATE])>"05"));

Easy enough... Lost a few brain cells over the years.
 
T

Tom van Stiphout

On Mon, 1 Dec 2008 19:40:29 -0800 (PST), Techhead

Check out the DateDiff function in the help file. Then create a query
like this:
select * from Records
where DateDiff("d",StartDate,EndDate) > 5

-Tom.
Microsoft Access 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