DateAdd question


A

azu_daioh

I posted this on the wrong group. Reposting for better result.
Thanks.

------------
Im trying to get all the files with any time posted 3 hours earlier
than the current time. I'm using the DateAdd but it does not return
files

DateAdd("h", -3, Date)


So if Date = 06/28/07 04:50pm I want the code to return any files
dated on or before 06/28/07 01:50pm


but for some reason the DateAdd above does not return any files. even
if I have files dated befire 06/28/07 04:50


ref:
.PropertyTests.Add Name:="Last Modified", _
Condition:=msoConditionOnOrBefore, _
Value:=DateAdd("h", -3, Date), _


I could make the code work if I use "d" instead of "h"
I tried changind Date to Time but still no result


I checked the online help and this newsgroup and still couldnt figure
out why I'm not getting any result


Thank you.
 
Ad

Advertisements

M

Michael Gramelspacher

I posted this on the wrong group. Reposting for better result.
Thanks.

------------
Im trying to get all the files with any time posted 3 hours earlier
than the current time. I'm using the DateAdd but it does not return
files

DateAdd("h", -3, Date)


So if Date = 06/28/07 04:50pm I want the code to return any files
dated on or before 06/28/07 01:50pm


but for some reason the DateAdd above does not return any files. even
if I have files dated befire 06/28/07 04:50


ref:
.PropertyTests.Add Name:="Last Modified", _
Condition:=msoConditionOnOrBefore, _
Value:=DateAdd("h", -3, Date), _


I could make the code work if I use "d" instead of "h"
I tried changind Date to Time but still no result


I checked the online help and this newsgroup and still couldnt figure
out why I'm not getting any result


Thank you.

try this:

WHERE post_date <=DateAdd("n",DateDiff("n",0,Now())-180,0)
 
Ad

Advertisements

R

raskew via AccessMonster.com

Hi -
The Date() function doesn't include time. Trying changing it to Now(), e.g.

? dateadd("h", -3, now())

HTH - Bob
 

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

Similar Threads


Top