在SQL中使用正常的查询语句,在Access数据库中使用报错。字段内容都一样。该如何解决

在SQL中使用正常的查询语句,在Access数据库中使用报错。字段内容都一样。
在SQL中使用正常的查询语句,在Access数据库中使用报错。字段内容都一样。请大侠帮我看看要改哪些地方?

Delphi(Pascal) code



//===========================SQL2000版=======================================

            with dtm.QryExec do     
    begin
      Close;
      SQL.Clear;
      SQL.add('insert into LiuShui(pzh,sfbz,UserName,YsMoney,ll,KxDate) ');
      SQL.add('select a.Pzh,''收'',a.h_UName,a.h_Money,b.ll,convert(varchar(100),a.h_date,23)) from hdinfo a join dkinfo b on (a.h_kxPzh=b.pzh) where a.Lrdate between :TimeBegin and :TimeEnd');
      Parameters.ParamByName('TimeBegin').Value:=DateToStr(DateTime1.Date);
      Parameters.ParamByName('TimeEnd').Value:=DateToStr(DateTime2.Date+1);
      execsql;
    end;

//===========================Access版=======================================

            with dtm.QryExec do     
    begin
      Close;
      SQL.Clear;
      SQL.add('insert into LiuShui(pzh,sfbz,UserName,YsMoney,ll,KxDate) ');
      SQL.add('select a.Pzh,''收'',a.h_UName,a.h_Money,b.ll,str(a.h_date) from hdinfo a join dkinfo b on (a.h_kxPzh=b.pzh) where a.Lrdate between :TimeBegin and :TimeEnd');
      Parameters.ParamByName('TimeBegin').Value:=DateToStr(DateTime1.Date);
      Parameters.ParamByName('TimeEnd').Value:=DateToStr(DateTime2.Date+1);
      execsql;
    end;



------解决方案--------------------
UserName这个字段改个名字看看。
或者是将str(a.h_date)改成 CStr(a.h_date)看看呢。
------解决方案--------------------
在Acess中对日期字段的查询条件要用#格式
select * from TableA where ADate>=#2011-01-01# and ADate<=#2011-01-01#
------解决方案--------------------
探讨

在Acess中对日期字段的查询条件要用#格式
select * from TableA where ADate>=#2011-01-01# and ADate<=#2011-01-01#