The information in this article applies to:
SUMMARYMicrosoft Access 7.0 and 97 MDB files can be password protected. This article demonstrates how to change the password associated with a Microsoft Access 7.0 or 97 MDB file. MORE INFORMATION
Microsoft Access 7.0 and 97 use Jet 3.0 and Jet 3.5 MDB files,
respectively. For the code below to work correctly, you must have a
reference to an appropriate Microsoft DAO Object Library.
The code above does not handle the possibility of trying to open the database with the wrong password, which would generate an error. Every application that tries to open password protected databases should be able to handle this scenario. To remove password protection from a database, use an empty string for the second parameter of the NewPassword method. For example:
To assign a database password to a MDB that is currently without a password, use an empty string for the first parameter of the NewPassword method. For example:
You can also change, assign or remove a database password using the CompactDatabase method. When using this method on a database with a password, the Optional arguments must be provided:
The new database has the same password as the old. Here you compact a MDB with a password of "MyPassword1" and give the new database a password of "MyNewPWD":
With this line, you can remove the database password:
This line compacts a database without a password and assigns a password of "NewPassword" to the new database:
Keywords : kbVBp400 kbVBp500 kbGrpVB kbhowto VB4WIN VBKBVBA kb32bitOnly |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |