dim tmpName as string
if trim(text3.text)="" then
tmpName=""
else
tmpName=" and 姓名='"& trim(text3.text) &"'"
end ifsql="select * from A where time between #" & Text1.Text & "# and #" & Text2.Text & "#" & tmpName
这句是在ACCESS上使用,
如果在SQL上如何修改?
if trim(text3.text)="" then
tmpName=""
else
tmpName=" and 姓名='"& trim(text3.text) &"'"
end ifsql="select * from A where time between #" & Text1.Text & "# and #" & Text2.Text & "#" & tmpName
这句是在ACCESS上使用,
如果在SQL上如何修改?
if trim(text3.text)="" then
tmpName=""
else
tmpName=" and 姓名='"& trim(text3.text) &"'"
end if sql="select * from A where time between #" & Text1.Text & "# and #" & Text2.Text & "#" & tmpName debug.print sql '截取sql到数据库中运行
找到原因了,谢谢大家,是我自己马虎.