Access 2013 项目中不存在 ADODB,如何添加对它的引用

编程入门 行业动态 更新时间:2024-10-25 22:31:08
本文介绍了Access 2013 项目中不存在 ADODB,如何添加对它的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在尝试在 Access 2013 as 和 mdb 中重建 Access adp 项目.两个版本中的表都是链接表,所以这不是问题.

I am trying to rebuild an Access adp project in Access 2013 as and mdb. The tables are all linked tables in both version so that is not an issue.

我已经从旧项目中导入了表单,所以表单布局和代码都在那里.

I have imported the forms from the old project so the form layouts and code is all there.

我在尝试执行以下代码时遇到问题:

Where I run into problems is when trying to execute the following code:

Dim cmd As New ADODB.Connection, RS As New ADODB.Recordset
cmd.ActiveConnection = connectionString
Debug.Print connectionString
cmd.ActiveConnection.CursorLocation = adUseClient
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_Myproc"
cmd.Parameters.Refresh
cmd(1) = Me.my_id
Set RS = cmd.Execute

'Should be checking if record set is open and explicitly close it. JWS
If RS.State = 1 Then
RS.Close
Set RS = Nothing
End If

cmd.ActiveConnection.Close

我无法声明 cmd 和 RS 变量,因为 ADODB 似乎不存在.我如何在 Access 中引用它或完成此操作的正确方法是什么?

I am not able to declare the cmd and RS variables because ADODB doesn't seem to exist. How do I reference this in Access or what is the correct way to accomplish this?

推荐答案

正如我在评论中所写,您需要检查 ADODB 引用是否已启用:

As I wrote in my comment, you need to check that the ADODB reference is enabled:

在 VBA 编辑器上,单击工具"菜单,然后单击引用..."验证Microsoft ActiveX 数据对象 x.x 库"的复选标记是否已激活;如果不是,请激活它.

进一步参考:使用ADO 与 Microsoft VB &VBA

这篇关于Access 2013 项目中不存在 ADODB,如何添加对它的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-23 08:05:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1038459.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中不   项目   Access   ADODB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!