Monday, September 26, 2011

How to Change or Remove Password of MS Access Database

Once you share password with anyone due to any reason then it is quite possible it may be misuse. Due to some urgent or demanding office task suppose you have shared the password with someone. Once you have shared password of mdb files then that user is authorized to do changes and use all resources of that database. So it is always advisable to change or remove previous password from MS access database after that task get over. MS access has option to change or remove password.
Here you can read some methods to apply so that you can change or remove password of MS access database. The NewPassword method is used for changing or removing password. Follow the code written below, this code for changing password “password1” to “password2” of the access database “accessdatabase.mdb”.
By NewPassword Method:
Sub ChangeDBPassword ()

Dim Db As Database

Set Db = OpenDatabase("C:\My Documents\MyDB.mdb",True, _


Db.NewPassword "MyPassword1","MyPassword2"


End Sub

By CompactDatabase method:

Sub CompactDB ()

' Compact the database, supplying the password

DBEngine.CompactDatabase "C:\My Documents\MyDB.mdb", _

"C:\My Documents\Test.MDB", dbLangGeneral, dbVersion30, _


End Sub

Above method will change MS access database password. But above code not handle the possibility of trying to open the database with the wrong password, which would generate an error.
Remove password from MS Access Database: It is quite easy to remove password from MS Access database. You can do it with NewPassword method by using empty string for second parameter of the NewPassword method.
Db.NewPassword "MyPassword2", ""
Applying Password on Access Database: You can also apply password on access database files with the use of NewPassword method. You need to just make slight changes in the code. Use empty string first and write password of your choice in second parameter.
Db.NewPassword "", "MyPassword1"
MS Access lost password Recovery: It is difficult to do changes on access database if you forget the database password. To apply above methods you must have access of your database files. Lost password can be recovered with accesspassword recovery software. These tools will recover lost password in few mouse click.
Enhanced by Zemanta

No comments:

Post a Comment


Related Posts Plugin for WordPress, Blogger...