Thomas,

Try this:

<cfquery name="bulletins"
        datasource="News">

SELECT * 
        FROM
        Articles
        WHERE
        approved > #Now()# AND startdate > #Now()#
        AND expirydate < #Now()#
</cfquery>

What you had was: where approved and startdate ... You have to test both for equality 
separately, unless you are using the BETWEEN operator.  Don't quote me on this, but 
the reason why it didn't error out was because the "WHERE approved" part was just 
checking for any value in that field at all.  The worst bugs are the ones that do not 
generate errors.

-Andy 

> -----Original Message-----
> From: Thomas Chiverton [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 10:45 AM
> To: CF-Talk
> Subject: Selecting a date range, access DB
> 
> 
> My aim is to pick all records out of an access DB, by date range.
> I'm using the following CF:
> <cfquery name="bulletins"
>          datasource="News">
>   SELECT * FROM Articles
>   where approved 
>   and startdate > #Now()# and
>   expirydate < #Now()#
> </cfquery>
> Turning on debug on the server shows this ends up as
> SQL = SELECT * FROM Articles where approved and startdate > {ts 
> '2001-02-26
> 15:37:22'} and expirydate < {ts '2001-02-26 15:37:22'} 
> 
> Unsuprisingly, this returns no results (there is at least one 
> record in the
> intended range). Is my SQL off, or do I need to use a particular type of
> date in access ?
> 
> Regards,
> 
> Thomas Chiverton,
> Intranet Webmaster and Desktop Analyst
> Office:       01565 757 909
> As a GUI, reality in useless...
> 
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to