469,304 Members | 2,303 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,304 developers. It's quick & easy.

compare date field to current date

Need some hwlp with comparing a date field retrieved from an access
date base to the current date. Basically I'm looking to create and if
statement like:
If strArticleDate < = Current Date then
else...

Thanks for any help or feedback
Mike
Jul 19 '05 #1
4 16047
Try using DateDiff

if DateDiff("d",strArticleDate, CurrentDate)>0 then
'whatever
"Michael Haas" <mh***@mail.lr.k12.nj.us> wrote in message
news:16**************************@posting.google.c om...
Need some hwlp with comparing a date field retrieved from an access
date base to the current date. Basically I'm looking to create and if
statement like:
If strArticleDate < = Current Date then
else...

Thanks for any help or feedback
Mike

Jul 19 '05 #2

I'm having a problem witht he currentdate part:
if I substitute "02/15/2004" for CurrentDate it works
Do I need to format CurrentDate? how should I decalre it?
Thanks for the help again.
Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
You shouldn't have to worry about formatting.

WHERE dateColumn <= Date()

or better yet, if dateColumn has time information,

WHERE dateColumn < DATEADD("d", 1, Date())

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Mike Haas" <mh***@mail.lr.k12.nj.us> wrote in message
news:u8**************@TK2MSFTNGP12.phx.gbl...

I'm having a problem witht he currentdate part:
if I substitute "02/15/2004" for CurrentDate it works
Do I need to format CurrentDate? how should I decalre it?
Thanks for the help again.
Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4

That did the trick, thanks
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by peashoe | last post: by
2 posts views Thread by AdityaK | last post: by
1 post views Thread by ToysNTreasures | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.