日期当然可以用“=、>或<”来判断,试试这样写(去掉单引号): sql = "select * from 综合资料表 where 日期>=#" & z & "# and 日期<=#" & y & "#"
sql = "select * from 综合资料表 where 日期>=# '" & z & "'# and 日期<=# '" & y & "'#" 日期>=# " & z & "#没有单引号的!!最好这样日期>=# " & Format(z,"long date") & "# 我一直用dtpicker这个时间控间,在windows common controls-2 6.0里面
hycao(海草) 说的没错,将单引号 '去掉就可以了
用JetSql函数比较保险日期格式(z="2001-03-8") Dim z ,y z = text3 (由text3输入) y = text4 (由text4输入) Dim sql sql = "select * from 综合资料表 where 日期>=Cdate('" & z & "') and 日期<=CDate('" & y & "')"
之后在按你的查找看看
sql = "select * from 综合资料表 where 日期>=#" & z & "# and 日期<=#" & y & "#"
我一直用dtpicker这个时间控间,在windows common controls-2 6.0里面
说的没错,将单引号 '去掉就可以了
Dim z ,y
z = text3 (由text3输入)
y = text4 (由text4输入)
Dim sql
sql = "select * from 综合资料表 where 日期>=Cdate('" & z & "') and 日期<=CDate('" & y & "')"