|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
我在access中打开记录集recordcount总是为0,帮忙解决下啊
代码如下
Private Sub chulidetail(addr As String, user As String, sid As String)
Dim j As Integer
Dim sqlstr As String
sqlstr = "select id,应收保费,业务员 from sheet1 where 业务员='" + user + "' and 通讯地址 like '*" + addr + "*'"
Set rsttemp = New ADODB.Recordset
rsttemp.Open sqlstr, CurrentProject.Connection, 3,1
For j = 0 To rsttemp.RecordCount - 1 ’这个位置的recordcount总是0
bfsum = bfsum + CDbl(rsttemp("应收保费"))
bfcount = bfcount + 1
rsttemp.MoveNext
Next j
If (rsttemp.BOF And rsttemp.EOF) Then
excstr = "update rtable set 9月应收保费='" + CStr(bfsum) + "',9月应收件数='" + CStr(bfcount) + "' where 序号=" + sid
CurrentProject.Connection.Execute (excstr)
End If
rsttemp.Close
rsttemp = Null
End Sub
谢谢了 |
|