Labeled (mdb/ms access) database icon with shortcut identification (Photo credit: Wikipedia) |
Password-Protected MS access 2000
database can be open without enserting password. This action can be
performed with the use OpenCurrentDatabase method. But
OpenCurrentDatabase method does not provide a parameter for
specifying a password for password-protected databases. So you need
to use Data Access Objects (DAO) method to specify database
password then use OpenCurrentDatabase method to open MS access
database.
Here I am going to explain step by step
procedure to open access database. It is requested you to create
backup of original database (sample.mdb) file and apply bellow
written method on backup copy.
- First start Microsoft Access 2000.
- Open the sample database sample.mdb for exclusive use. To open the database for exclusive use, click sample.mdb in the Open dialog box, click the arrow next to the Open button, and then click Open Exclusive.
- On the Tools menu, point to Security, and then click Set Database Password.
- Type nwind in the Password and Verify boxes, and then click OK.
- Close the sample database sample.mdb.
- Open the sample database sample.mdb to verify that you receive a prompt to enter the database prompt.
- Click Cancel to prevent the database from opening.
- Create a new, blank database.
- Open a new module in Design view.
- On the Tools menu, click References.
- Add a reference to the Microsoft DAO 3.6 Object Library, and then click OK to close the References dialog box.
- Add the following code to the module:
Option
Compare Database
Option
Explicit
Sub
OpenPasswordProtectedDB()
'Define as Static so the instance of Access
'doesn't close when the procedure ends.
Static acc As Access.Application
Dim db As DAO.Database
Dim strDbName As String
strDbName = "C:\Program Files\Microsoft
Office\Office\Samples\sample.mdb"
Set acc = New Access.Application
acc.Visible = True
Set db = acc.DBEngine.OpenDatabase(strDbName, False, False,
";PWD=nwind")
acc.OpenCurrentDatabase strDbName
db.Close
Set db = Nothing
End
Sub
- Run the OpenPasswordProtectedDB subroutine in the Immediate window.
Now you will see that sample.mdb
database will open without asking for password. This method works for
MS Access 2000. This is very good but lengthy method, you must have
some programing knowledge to impliment it. If you are in hurry then
use access password recovery software to recover lost MS
access password.
No comments:
Post a Comment