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

时间:2010-01-29 19:55:57

标签: ms-access passwords

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

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

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

如何删除密码?

2 个答案:

答案 0 :(得分:3)

创建一个新的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

感谢ERIC MATTHEW VAJENTIC

答案 1 :(得分:2)

您是否以“独占模式”打开数据库?

  

文件|打开|选择数据库文件|   三角形“打开”命令旁边   按钮|打开独家