Strange query problem!

Category: MS-SQL Server -> Applications Author: ailler1983 Date: 2001-07-08 11:11:16
2001-07-08 11:11:16
Because of work requirements, the SQL Server version of the Access database conversion into a database, which with some rules and stored procedures, the question now is:
I have written some queries, then the establishment view in Access can properly query window, but if I put this statement into use on vb6 error, an error message is probably means that may be using the reserved word or spelling errors, but obviously I can query in Access inside ah.
2001-07-08 11:29:01
about this topic, please refer to:
Why old appeared XXX function undefined error? "Function"

datepart in the ANSI SQL is not supported
2001-07-08 11:37:16
paste my query:
select r.description as reader, p.staffno, datepart ('yyyy', a.attendtime) as nyear, datepart ('h', a.attendtime) as hour , datepart ('n', a.attendtime) as minute, datepart ('m', a.attendtime) as month, datepart ('D', a.attendtime) as day from (attendancetx as a inner join (select * from personal where cardlocked = 0) as p on a.CardNo = p.Cardno) left join attreader as r on r.readerid = a.readerid Where a.attendtime between # 2004-03-15 18:00:00 # and # 2004-07-06 12:59:59 # order by a.attendtime

2001-07-08 11:45:08
Error Occured: -2147217900
The Select statement includes a reserved word or an argument name that is mispelled or missing, or the punctuation is incorrect.
2001-07-08 11:57:15
Open Database command are here:
rstReturnRec.CursorLocation = adUseClient
rstReturnRec.Open strSQL, gcnnAdoConn, adOpenKeyset, adLockOptimistic, intOption
2001-07-08 12:05:38
That Will changechange (access911 & cg1):
can help rewrite my sentence about it?