View Full Version : help with a date query


jonnycattt
11-01-2001, 05:23 AM
Greetings. I am using ColdFusion to return a recordset, but I want to turn the CF query into an Access query. My problem is that I use variables in the CF query and I don't know how to rewrite this as an access query. Here's my CF code:

set variables:
<CFSET TargetDate=Now()>
<CFSET TwoDaysAgo=DateAdd("d",-2,TargetDate)>

sql statement:
SELECT ArticleID, AuFirstName, AuLastName, CorAuEmail, CorAuFirstName, CorAuLastName, LogicID, MailDate, WasNagged, SendNoNag, IssueMonth
FROM JPET
WHERE (WasNagged<>'Yes' OR WasNagged Is Null)
AND (MailDate<=#TwoDaysAgo#)
AND (PagesReturned Is Null)
AND (SendNoNag<>'Yes' OR SendNoNag Is Null)

The thing is, I need to learn how to set the targetdate and TwoDaysAgo parameters in Access and then use those parameters in the sql statement.

thanks in advance for any help.

Marc

pdx_man
11-01-2001, 07:47 AM
Just substitute you formulas for the parameters.

SELECT ArticleID, AuFirstName, AuLastName, CorAuEmail, CorAuFirstName, CorAuLastName, LogicID, MailDate, WasNagged, SendNoNag, IssueMonth
FROM JPET
WHERE (WasNagged<>'Yes' OR WasNagged Is Null)
AND (MailDate<=DateAdd("d",-2,Now()))
AND (PagesReturned Is Null)
AND (SendNoNag<>'Yes' OR SendNoNag Is Null)

jonnycattt
11-01-2001, 09:01 AM
Too easy. Thanks!

Marc