注册 登录
编程论坛 VB6论坛

关于ACCESS数据库时间查询的问题

linandceline 发布于 2015-03-30 17:05, 523 次点击
我想统计ACCESS里符合多项条件的数量,代码如下
Text5.Text = FormatDateTime(Now, vbShortDate)

Set Conn = CreateObject("ADODB.Connection")
Connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\新增信息.mdb"
Conn.Open Connstr
Set Rs = CreateObject("adodb.recordset")
SQL = "Select 编号 From SFILE where 时间 = #" & Text5.Text & "# and 类别='DY'"
Rs.Open SQL, Conn, 1, 2

k = Rst.recordCount

其中时间的查询已经试了好多,SQL就是不对
where 时间 = # 2015-3-30 # 这样是可以查询的,但用变量就怎么都代不进去
求助
2 回复
#2
linandceline2015-03-30 17:16
已处理,各位无需费神
#3
dyt52016-02-24 18:23
1