在 Windows 365 中连接到另一个访问数据库 [英] Connecting to another access database in windows 365

查看:53
本文介绍了在 Windows 365 中连接到另一个访问数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已从 Windows 7 升级到 Windows 365.

We have upgraded from Windows 7 to windows 365.

我们在访问数据库中有一个宏.该宏使用以下代码打开另一个数据库.但是,由于移动到 windows 365,它不喜欢 cn.open 行.

We have a macro within an access database. The macro opens another database using the code below. However since moving across to windows 365 it doesn't like the cn.open line.

如何从 Windows 365 中的 Access 连接到另一个数据库?

How do you connect to another database from within Access in windows 365?

 dim cn As ADODB.Connection
 set cn = New ADODB.Connection
 cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & pDBPATH & pDBNAME

错误信息是,

运行时错误 3706:找不到提供程序.它可能没有正确安装.

run-time error 3706: Provider cannot be found. it may not be properly installed.

虽然阅读后看起来 Microsoft Jet OLEDB 4.0 不是 64 位.那么还有其他方法吗?

Although after reading it looks like Microsoft Jet OLEDB 4.0 is not 64 bit. So is there another way?

推荐答案

Access 中的数据库之间有多种连接方式.

There are many ways to connect between databases in Access.

最常用的 OLEDB 连接提供程序是 Microsoft.ACE.OLEDB.12.0 提供程序:

The most usual provider for OLEDB connection is the Microsoft.ACE.OLEDB.12.0 provider:

cn.Open "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & pDBPATH & pDBNAME

您可以通过执行以下代码查看 Access 用于连接到当前数据库的两个不同的提供程序:

You can view two different providers Access uses to connect to the current database, by executing the following code:

Debug.Print CurrentProject.Connection.ConnectionString 'Usual connection
Debug.Print CurrentProject.AccessConnection.ConnectionString 'Used for updateable forms

这篇关于在 Windows 365 中连接到另一个访问数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆