无法从 Microsoft Access 2007 (accdb) 中删除密码

pau*_*aul 4 passwords ms-access

我有一个 Microsoft Access 2007 (accdb) 文件。我在上面设置了密码。当我现在打开它时,系统会提示我输入密码。我输入正确的密码,就可以访问它。

但是,我想删除密码。我单击“数据库工具”,但在数据库工具中,我只看到“用密码加密”,这与帮助文件相反(它说我应该看到“解密密码”。)

Access UI 似乎认为我没有密码,因此它不会给我删除密码的选项。

我怎样才能删除密码?

小智 5

创建新的 Access 数据库 创建新的表单 创建命令按钮

执行以下代码(更改代码以访问您的数据库和密码)

Public Sub Command0_Click()
Dim objConn As ADODB.Connection
Dim strAlterPassword As String

On Error GoTo ChangeDBPassword_Err

' Create the SQL string to change the database password.
' Here, "It" is the old password, and I am wanting to set the password to NULL
'    Replace "It" with your password
strAlterPassword = "ALTER DATABASE PASSWORD NULL [It];"

' Open the secured database.
Set objConn = New ADODB.Connection

With objConn
.Mode = adModeShareExclusive
.Provider = "Microsoft.ACE.OLEDB.12.0"
'  Replace "It" with your old password
.Properties("Jet OLEDB:Database Password") = "It"
'The following specifies the location of the database of which PW I'm trying to change.
'    Replace path to your database 
.Open "Data Source= G:\Database\database.accdb;"
' Execute the SQL statement to change the password.
.Execute (strAlterPassword)
End With

' Clean up objects.
objConn.Close
Set objConn = Nothing

ChangeDBPassword_Err:
MsgBox Err.Number & ":" & Err.Description
End Sub
Run Code Online (Sandbox Code Playgroud)

感谢埃里克·马修·瓦金蒂克