Click to See Complete Forum and Search --> : Help - about SELECT by date in Access


mongkb
08-14-2006, 09:34 PM
Help - about SELECT by date in Access

Hi all, I've created a table in Access and I assigned the date format to a field , named 'bdate', to "dd/mm/yyyy", the 'bdate' records are:

1. 23/07/2006
2. 02/08/2006
3. 15/08/2006

Here is the ASP Code:


<%session.lcid=2057%>
<%
selDate = FormatDateTime(selDate, 2)
strSQL = "SELECT * FROM tblList WHERE bdate = #" & selDate & "#"
Set rs = ObjConn.Execute(strSQL)
%>


Problem:
This SQL works fine with record no.1 and 3, but select no.2 will result EOF, but if I change the selDate to 08/02/2006, the record no.2 will be found.

I've made a debug page here, it clearly shows the detail of the issue:
http://www.mong.hk/test/c.asp

Can someone help me to solve this problem, thank you very much for your time and sorry for my poor English.

gil davis
08-15-2006, 07:57 AM
The definition of FormatDateTime() says:Display a date using the short date format specified in your computer's regional settings.What is the regional setting for your server?

mongkb
08-15-2006, 09:15 AM
What is the regional setting for your server?

The regional setting is 'United Kingdom', In Control panel -> Locale -> it shows the date format is DD/MM/YYYY.