Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing MS Access password using OLEDB Connection

Status
Not open for further replies.

mimpuerto

Programmer
Mar 19, 2003
5
GB
Hello!

I really want to know how to change password of an MS Access database through OLEDb. If I have db1.mdb, my connection string would be:

gstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;Jet OLEDB:Registry Path=;Jet OLEDB:Database Password=;Jet OLEDB:New Database Password=TEST;"

cnn.open gstr
cnn.close


this did not work. though i dont have any error but when i open db1.mdb, it did not apply my database password. Another way of doing it is:

gstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;Jet OLEDB:Registry Path=;Jet OLEDB:Database Password=;"

cnn.open gstr
cnn.Properties("Jet OLEDB:New Database Password")="test"
cnn.close


I got an error message Run-time error '-2147217887 (80040e21)':Read-only property value was not set.

Please help me.
 
You need to open the mdb exclusively, first of all, just like when using MS ACCESS and doing the same.
Use JRO (MS JET and Replication Object Library) to compact the mdb, and at the same time, you can change the password.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top