Current Date plus 30 days

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

So I guess on reading these discussions, that I am a bit of a beginner. I
know the basics of Access but I am struggling with a query.
I need to be able to create a query that pulls out property that has been
sitting for 30 days or more. So, I have my fields set as Time/Date - but I
do not know what the expression is to calculate Current Date plus 30 days (to
pull the records).

I am sure there is an easy answer, but I can't seem to find it in any Access
book I have!

Thank you so much - I have used these forums before and you always have
quick answers!
 
To get the current date + 30, you can use

Date + 30

Or, use the DateAdd function
DateAdd("d",30,Date())

The Date() return the current date.
 
So I guess on reading these discussions, that I am a bit of a beginner. I
know the basics of Access but I am struggling with a query.
I need to be able to create a query that pulls out property that has been
sitting for 30 days or more. So, I have my fields set as Time/Date - but I
do not know what the expression is to calculate Current Date plus 30 days (to
pull the records).

I am sure there is an easy answer, but I can't seem to find it in any Access
book I have!

Thank you so much - I have used these forums before and you always have
quick answers!

Your question is misleading. Do you wish records OLDER than 30 days
from today?

To get records older than 30 days:

< Date()-30

Also, you could use

< DateAdd("d",-30,Date())

Or do you wish records in the future, AFTER 30 days?
 
Thank you for your very quick response - but I am still confused.
I tried the date + 30 and got an error "Data type mismatch in criteria
expression" so I moved on to DateAdd("d",30,Date()) but it didn't pull any
records out?
I have two records in there now ; one less than 30 days and one that is more
than 30 days as a test.
My field is set to Time/Date (Medium Date). Is that my problem?
As well, I just copied and pasted the DateAdd("d",30,Date()) into the
criteria box... is that the correct way to do it? Or am I supposed to put
something where the "d" is?
Oh my, I sure feel silly asking these questions!! But very grateful for the
info!
 
Look at Fred's suggestions on how to get any date above or under 30 days, I'm
also not sure what you are trying to do.

Fred suggets more or less, you can also use between current date and date + 30

Where DateFieldName Between Date() And DateAdd("d",30,Date())

And, Yes it should be in the criteria section
 
I suppose my question IS misleading - here is my dilemna.

I am creating a database for found and lost property.
After 30days the property is allowed to be disposed of.
So, I am trying to make an "easy" query for the property guy to simply run
to give him a list of the property that has been sitting in the locker for 30
days or longer.
I really don't know what I am doing wrong, your suggestions certainly make
sense to me, however, when I put them into my criteria field, I get no items
showing up!
I am tearing my hair out.

Am I correct in using the Medium Date of the Time/Date field or should I be
using another field in my table?

Thanking you in advance..
 
I'm going to grasp at straws here and assume I do not have something set up
correctly.

In my "DateFound" field (set as Medium Date; Date/Time in the table), is
where I am putting DateAdd("d",-30,Date()) under Criteria

so theoretically, it should pull all records where the DateFound dates are
older than 30 days...

sure wish I could post the database!!!

You guys are great.
 
I suppose my question IS misleading - here is my dilemna.

I am creating a database for found and lost property.
After 30days the property is allowed to be disposed of.
So, I am trying to make an "easy" query for the property guy to simply run
to give him a list of the property that has been sitting in the locker for 30
days or longer.
I really don't know what I am doing wrong, your suggestions certainly make
sense to me, however, when I put them into my criteria field, I get no items
showing up!
I am tearing my hair out.

Am I correct in using the Medium Date of the Time/Date field or should I be
using another field in my table?

Thanking you in advance..

Now you want records 30 days or older?
The "Format" of the date field is irrelevant **IF** the field is a
Date datatype field. For example, today is stored as 38878.
All you need do, then, is subtract 30 from 38878 and return records
that match that number or are less than that number (meaning they are
older), i.e. 5/10/2006.

To find records 30 days and older, assuming the field is a Date
datatype, on the criteria line for that field, write:
<= Date() - 30
However, if your date field includes a time value (as well as the
date) i.e. 5/10/2006 19:30:00 PM, then you need to use
<= Date() -29
instead.
 
PMFBI

in your posts it sounds like
you are not also typing in the
"less than or equal" part?

Field: DateFound
Table:
Sort:
Show:
Criteria: <=DateAdd("d",-30,Date()
Or:
 
one day I will learn how to type
(earlier was missing closing parenthesis)

Field: DateFound
Table:
Sort:
Show:
Criteria: <=DateAdd("d",-30,Date())
Or:
 
THANK YOU!

YES! SUCCESS!

All those > before the lines were screwing me up! I thought the <= was a
part of the "forwarded" message!

LOL!

Thank you so very much!
 
Back
Top