简体   繁体   English

访问 VBA:dao.recordset 与记录集有什么区别?

[英]Access VBA: What is the difference between dao.recordset vs recordset?

In Access VBA is there a difference between:在 Access VBA 中有以下区别:

Dim rs   As Recordset
Dim rs   As DAO.Recordset

It depends on the references you have set in the VBA project.这取决于您在 VBA 项目中设置的引用。

If you haven't changed anything, then there are only DAO recordsets.如果您没有更改任何内容,那么只有 DAO 记录集。 If there is no chance that ADO will ever be used in that project,如果在该项目中永远不会使用 ADO,

Dim rs As Recordset

is enough to specify a DAO.Recordset .足以指定DAO.Recordset But for clarity it is still recommended to use但为了清楚起见,仍然建议使用

Dim rs As DAO.Recordset

But if you have both the Access database engine, and ActiveX Data Objects libraries in your references (see on the right),但是,如果您的参考文献中同时具有 Access 数据库引擎和 ActiveX 数据对象库(请参阅右侧),

DAO 和 ADO

then you must use the qualifier to specify what recordset you want (see left).那么您必须使用限定符来指定您想要的记录集(见左图)。 If you just use Dim rs As Recordset here, it will depend on the order of the references, which one is used.如果你只是在这里使用Dim rs As Recordset ,它将取决于引用的顺序,使用哪个。

The difference is, that also ADO has a Recordset.不同的是,ADO 也有一个 Recordset。 Using DAO makes it clear what the object is.使用 DAO 可以明确对象是什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM