Parameter query with dates

A

alecgreen

Hi hope you can help,

I have an orders table which contains order number and due date, I
want a query to return all records from the oldest date to 4 weeks in
the future.


Many Thanks


Alec
 
J

Jeff Boyce

Alec

So you're saying that you want the value of the [DueDate] to be between the
maximum value of the [DueDate] and four weeks out from there? Or between
the maximum value of the [DueDate] and four weeks out from today's date?

Do you care if a date falls on a weekend/holiday?

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Jerry Whittle

Are you saying that you want to add 4 weeks to the oldest date OR the oldest
date up to 4 weeks in the future?

What's that table and field names?
 
A

alecgreen

Are you saying that you want to add 4 weeks to the oldest date OR the oldest
date up to 4 weeks in the future?

What's that table and field names?
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.








- Show quoted text -

Sorry didnt make myself very clear! I want the oldest date in the
table [DUEDATE] to 4 weeks from todays date.
 
J

Jerry Whittle

Try this as the criteria for the date field in question:

Between #1/1/1800# And Date() + 28.99999

I'm cheating on the above a few ways. I's assuming that you don't have any
records older than the year 1800! That should get the oldest record.

Date() is a function that shows the date in the computer. Hopefully the time
and date on your computer is set right.

I could have used a fancy DateAdd function to add the 4 weeks to today's
date; however +28 will do the same.

The .99999 is in case you have that date field has a time component.
Otherwise it would skip any records that are after midnight on that day.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


alecgreen said:
Are you saying that you want to add 4 weeks to the oldest date OR the oldest
date up to 4 weeks in the future?

What's that table and field names?
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.








- Show quoted text -

Sorry didnt make myself very clear! I want the oldest date in the
table [DUEDATE] to 4 weeks from todays date.
 
J

Jeff Boyce

But what if the OP meant "newest" when claiming "oldest"?!?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Jerry Whittle said:
Try this as the criteria for the date field in question:

Between #1/1/1800# And Date() + 28.99999

I'm cheating on the above a few ways. I's assuming that you don't have any
records older than the year 1800! That should get the oldest record.

Date() is a function that shows the date in the computer. Hopefully the
time
and date on your computer is set right.

I could have used a fancy DateAdd function to add the 4 weeks to today's
date; however +28 will do the same.

The .99999 is in case you have that date field has a time component.
Otherwise it would skip any records that are after midnight on that day.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


alecgreen said:
Are you saying that you want to add 4 weeks to the oldest date OR the
oldest
date up to 4 weeks in the future?

What's that table and field names?
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.



:
Hi hope you can help,

I have an orders table which contains order number and due date, I
want a query to return all records from the oldest date to 4 weeks in
the future.

Many Thanks

Alec- Hide quoted text -

- Show quoted text -

Sorry didnt make myself very clear! I want the oldest date in the
table [DUEDATE] to 4 weeks from todays date.
 

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