Forums

This topic is locked

BETWEEN DATE Recordset Problem!

Posted 25 May 2004 10:50:57
1
has voted
25 May 2004 10:50:57 Ross Calvert posted:
When i try to filter the following recordset the fldCentre and fldSite are being filtered but the fldDate is showing all the records. The following text is out of the dreamweaver recordset editor. Ive checked to see that the correct values are being passed in the query string and ive tried using cdate to convert the string values to dates.

Many Thnks in Advance

PS The database is ms access



SELECT *
FROM tblLogTable
WHERE fldCentre = 'varCentre' AND (fldDate BETWEEN 'varStartDate' AND 'varEndDate') AND fldSite = 'varSite'

Replies

Replied 25 May 2004 12:11:09
25 May 2004 12:11:09 Vince Baker replied:
Are you using MS Access? If so you need to surround the dates with # marks. A strange syntax that Access uses.

Also, have you tried to hand code some dates in to see if that works?




Regards
Vince

DMX Talkzone Manager

Visit my home: www.chez-vince.com
(Now completely CSS based and bye bye to all tables!)

VBScript | ASP | HTML | CSS | SQL | Oracle | Hosting

Edited by - bakerv on 25 May 2004 12:12:00
Replied 25 May 2004 14:00:17
25 May 2004 14:00:17 Ross Calvert replied:
where do i put the #`s i can't seem to get it to work. cheers
Replied 25 May 2004 14:48:40
25 May 2004 14:48:40 Vince Baker replied:
For MS Access this is an example of the between date method (taken from a page i have that works)

SELECT add_book_id, add_book_name, add_book_birthday
FROM tbl_addresses
where add_book_birthday between #01/05/70# and #01/05/90#

Just place your variables in place of the two dates I have typed. so you will have:

SELECT add_book_id, add_book_name, add_book_birthday
FROM tbl_addresses
where add_book_birthday between #varFromDate# and #varToDate#


Regards
Vince

DMX Talkzone Manager

Visit my home: www.chez-vince.com
(Now completely CSS based and bye bye to all tables!)

VBScript | ASP | HTML | CSS | SQL | Oracle | Hosting

Edited by - bakerv on 25 May 2004 14:49:34
Replied 25 May 2004 16:29:48
25 May 2004 16:29:48 Ross Calvert replied:
thanks it works now,

much appreciated <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Reply to this topic