xbb 发表于:2018-08-26 12:43:08
前提:tblcodedbsj表中,存在dbid=071420141762,dbyearmonth=2018年08月,都为文本字段
Dim yearmonth As String
Dim txtdbid As String
Dim integerCount As Integer
yearmonth = "2018年08月"
txtdbid = "071420141762"
integerCount = DCount("*", "tblcodedbsj", "[dbid]=' " & txtdbid & " ' and [dbyearmonth]=' " & yearmonth & " ' ")
MsgBox ("有" + CStr(integerCount) + "个记录" + "-" + txtdbid + "-" + yearmonth)
运行后,显示 "有0个记录-071420141762-2018年08月"
记录正确应该是1,但是这里是0,为什么会是0呢?
如果用RecordCount来写这段代码,应该如何写呢?
我试了没问题:把空格去掉,写成
integerCount = DCount("*", "tblcodedbsj", "[dbid]=' " &txtdbid &"' and [dbyearmonth]='"&yearmonth &"'")
总记录:1篇 页次:1/1 9 1 :