Process a password-coded MDB file

Source: Internet
Author: User
When the MDB file has a password and the MDB file is printed directly by Access, the Password dialog box appears, asking for the password. However, to be printed in VB program, you must change the VB program to open the MDB file instructions, otherwise there will be error messages! The following are described in a variety of situations:

1. Open the MDB file using the DAO command: OpenDatabase
To open in a program, the commands are as follows:
Set DB = OpenDatabase (DatabaseName, False, false, "; pwd= password ")
Instance:
Dim DB as Database
Set db = OpenDatabase ("C:\db1.mdb", False, false, "; Pwd=1 ")
To use the Data control, you set the method as follows:
1, set the DatabaseName property (MDB file name/include path)
2, set Connect properties, the preset string "Access" to ";" pwd= password "(excluding double quotes)
3. Set RecordSource Properties

2,

To open an MDB file using the ADO command:

After using ADODC or DataEnvironment, modify the ConnectionString property (attached to ADODC) or the Connectionsource property directly using the Properties window (attached to the DataEnvironment Co Nnection control), the modified method is to add the following parameters after the property:
; Jet oledb:database password= Password

In addition to ADODC and DataEnvironment, you use an ADO control to open an MDB MDB file with a password, and the method of setting the parameters is the same.


3,

To compress a password-coded MDB file: CompactDatabase

Dbengine.compactdatabase "Original MDB file", "New MDB file",,, ";p wd= password"
Examples for example:
Dbengine.compactdatabase "C:\Db1.mdb", "C:\Db2.mdb",,, ";p wd=1"

4,

To fix a password-coded MDB file: repairdatabase

No need to ignore the password set by the MDB file!
Dbengine.repairdatabase "MDB file"
Examples for example:
Dbengine.repairdatabase "C:\Db1.mdb"







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.