471,852 Members | 984 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,852 software developers and data experts.

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 16118
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 YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.