与受保护的访问accdb文件的连接会抛出“错误密码",提示“密码错误". [英] Connection to protected access accdb file throws "Wrong Password"

查看:125
本文介绍了与受保护的访问accdb文件的连接会抛出“错误密码",提示“密码错误".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到加密访问2013 accdb文件,该文件正在通过excel文件中的adodb vba过程使用旧版加密.

I am trying to connect to an encrypted access 2013 accdb file which is using legacy encryption through an adodb vba procedure within an excel file.

该过程在cn.open失败,我正在使用Office 64位,错误消息:它不是有效的密码". 这个问题的特殊性是,密码正确,我可以通过Microsoft查询很好地连接到Access DB,并且可以使用下面的代码连接到另一个Access DB.但是,当我尝试在Excel上使用它时,此错误就会出现,请注意,我已经在access和excel上启用了相同的引用 VBA编辑器.

The Procedure fails at cn.open, I am using office 64 bits, error message: "It is not a valid Password". The particularity of this problem is, the password is correct, I can connect to the Access DB through Microsoft query just fine, and I can connect with another access DB with the code below. But when I try to use it on Excel, this error jumps in, take note, I have enabled the same references on both access and excel vba editor.

我的问题是,如何通过excel从受密码保护的访问文件中提取数据,输入密码后尝试的每种方法都会失败.

My question is, how can I extract data from this password protected access file through excel, each and every method I try fail after I have typed the password.

VBA程序

Sub LDBViewer2010()
'Reference Microsoft ActiveX Data Objects for this code to work

Dim cn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Const conDatabase As String = "E:\1.accdb"

    ' Open connection to Access backend
   cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & conDatabase & ";Persist Security Info=False;Jet OLEDB:Database Password='asd123';"

    ' Open recordset
   Set Rs = cn.OpenSchema(adSchemaProviderSpecific, , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")

    'Output the field list
   Debug.Print Rs.Fields(0).Name, "|", Rs.Fields(1).Name, "|", Rs.Fields(2).Name, "|", Rs.Fields(3).Name

    'Loop through users recordset of users in database.
   While Not Rs.EOF
        Debug.Print Trim(Rs.Fields(0)), "|", Trim(Rs.Fields(1)), "|", Trim(Rs.Fields(2)), "|", Trim(Rs.Fields(3))
        Rs.MoveNext
    Wend

    ' Close
   If Rs.State <> adStateClosed Then Rs.Close
    Set Rs = Nothing
    Set cn = Nothing

End Sub

非常感谢您的时间和帮助.

I greatly appreciate your time and help.

-编辑1-

在Access中使用debug.print CurrentProject.Connection.ConnectionString:

Using debug.print CurrentProject.Connection.ConnectionString in Access:

Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=E:1.accdb;Mode=Share Deny None;Extended Properties="";Jet OLEDB:System database=C:\Users\User\AppData\Roaming\Microsoft\Access\System.mdw;Jet OLEDB:Registry Path=Software\Microsoft\Office\15.0\Access\Access Connectivity Engine;Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=6;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False;Jet OLEDB:Support Complex Data=True;Jet OLEDB:Bypass UserInfo Validation=False;Jet OLEDB:Limited DB Caching=False;Jet OLEDB:Bypass ChoiceField Validation=False

推荐答案

解决了该问题,它创建了一个新的访问文件并进行了进一步的测试.这是我发现的.

Solved it creating a new access file and doing some further testing. Below is what I found out.

尽管我使用遗传加密创建了数据库,但是无论哪种方法,密码始终会失败.我尝试使用相同的密码进行解密和重新加密,现在excel连接就很好了.

Although I created my database with hereditary encryption, the password always failed whichever the method. I tried Decrypting and Re-encrypting with same password and now excel connects just fine.

请注意,只有excel才有连接问题,我可以毫不费力地从另一个Access DB进行连接.

Take note that only excel had trouble connecting, I could connect from another access DB without a hitch.

感谢您的想法&贡献,他们帮助我找到了正确的答案.

Thank you for your ideas & contributions, they helped me get the right answer.

这篇关于与受保护的访问accdb文件的连接会抛出“错误密码",提示“密码错误".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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