使用 RecordCount 属性获取记录集中的记录数,而不是轮询代码来计算记录数。以下是示例代码:
Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("table_name")
If Not (rs.EOF And rs.BOF) Then rs.MoveLast rs.MoveFirst Debug.Print "记录数:" & rs.RecordCount End If
rs.Close Set rs = Nothing
上一篇:遍历5个数据结构的for循环
下一篇:遍历ActiveX控件并设置属性