By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,479 Members | 988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,479 IT Pros & Developers. It's quick & easy.

Having a problem with the date field

P: n/a
I have a table with an 'orderdate' field.
this is a date type.

I am trying to return all records that have an orderdate of within 30 days
from todays date.

The datediff in a sql query did not seem to work

what am i doing wrong?

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In the Criteria row of your query, under the date field, enter:
Between Date() - 30 And Date() + 30

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Danny" <da********@hotmail.com> wrote in message
news:6N*********************@news4.srv.hcvlny.cv.n et...
I have a table with an 'orderdate' field.
this is a date type.

I am trying to return all records that have an orderdate of within 30 days
from todays date.

The datediff in a sql query did not seem to work

what am i doing wrong?

Nov 12 '05 #2

P: n/a
Since you didn't show us how you used the DateDiff, we don't know what was
wrong. I suspect though, that you want to use DateAdd not DateDiff. Because
of the way Access/VBA store dates, you can also simply use addition and
subtraction for dates.

Example Criteria:
Date()-30 orDateAdd("d", -30, Date())
--
Wayne Morgan
Microsoft Access MVP
"Danny" <da********@hotmail.com> wrote in message
news:6N*********************@news4.srv.hcvlny.cv.n et... I have a table with an 'orderdate' field.
this is a date type.

I am trying to return all records that have an orderdate of within 30 days
from todays date.

The datediff in a sql query did not seem to work

what am i doing wrong?

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.