PDA

View Full Version : another date issue



twisted-pixel
03-31-2007, 05:20 PM
Hi all,

ok...ASP and b****y dates!!

I have a DB (access) with a number of records. Each record has a date inserted using the date() funtion (session.LCID=2057 so I get the UK format dd/mm/yyyy) which range from 03/03/2007 to 30/03/07.

now, I'm trying to run a query that gives me a history of records over the last x number of days

so I have

numdays = request.form("numdays")
datediff = date() - numdays
strSQL = "SELECT record_id FROM historytbl WHERE record_date >#" & datediff & "#"

so for 1 days the query string is

SELECT record_id FROM historytbl WHERE record_date >#30/03/2007# (where today is 31)

for 3 days...

SELECT record_id FROM historytbl WHERE record_date >#28/03/2007# (where today is 31)

etc etc

this works fine until I get to 7 or more days...then I get an EOF or BOF is true error message.


checking the query string...

SELECT record_id FROM historytbl WHERE record_date >#24/03/2007# (where today is 31)

so I can't see why this is failing...anyone any ideas??

twisted-pixel
03-31-2007, 05:29 PM
ok..apologies..ignore the above..the fault is somewhere else (running two queries in tandem and it's the second one that's falling over)

sorry about that folks