什么是VBA中的Recordset? ...它的目的是什么? [英] What is a Recordset in VBA? ... what purpose does it serve?
本文介绍了什么是VBA中的Recordset? ...它的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
VBA中的 Recordset
是什么?
What is a Recordset
in VBA?
它的用途是什么?
如何使用它们?
推荐答案
这是一个很大的问题。简而言之,记录集是来自表或查询的记录的选择。根据使用的查询,它可以用于添加,编辑,删除和操作记录。记录集可以使用ADO或DAO获得,并且可以具有相应的不同方法和属性。粘贴到DAO,这是Access本地的:
This is quite a large question. Briefly, a recordset is a selection of records from a table or query. Depending on the query used, it can be used to add, edit, delete and manipulate records. A recordset can be obtained using ADO or DAO and may have different methods and properties accordingly. Sticking to DAO, which is native to Access:
Dim rs As DAO.Recordset
Set rs=CurrentDB.OpenRecordset("Select ID, Company From Companies")
rs.Edit
rs!Company="ABC"
rs.Update
rs.AddNew
rs!Company="ABC"
rs.Update
Do While Not rs.EOF
If rs!Company="ABC" Then
''Do something
End If
rs.MoveNext
Loop
Set rs=Forms!SomeForm.RecordsetClone
rs.FindFirst "Company='ABC'"
If Not rs.NoMatch Then
Forms!SomeForm.Bookmark=rs.Bookmark
End If
这篇关于什么是VBA中的Recordset? ...它的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文