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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime error connecting to Access DB wth when PWD is set...

Status
Not open for further replies.

hughg

Programmer
May 16, 2001
8
IE
I am trying to connect to an Access DB using a standard ADO connection object. This runs perfectly when I do not set a password for the database;

Dim cn As Connection
Set cn = New Connection

With cn
.Provider = "Microsoft.jet.OLEDB.3.51"
.ConnectionString= "Userid=Admin;" & _
"DataSource=C:\Test.mdb"
.Open
End With

However on setting the password in the Access DB & running the following code again, with the password string included:

Dim cn As Connection
Set cn = New Connection

With cn
.Provider = "Microsoft.jet.OLEDB.3.51"
.ConnectionString= "Userid=Admin;" & _
"Password=test;DataSource=C:\Test.mdb"
.Open
End With

I get the following error message:

Runtime Err: '-2147467259 (80004005)'
"Can't start your application. The workgroup information file is missing or opened exclusively by another user"

Could somebody please advise?
Thanks very much in advance.
Hugh

vb6sp4
msaccess97
wos95

 
Hey Hugh,

Try adding this line instead of putting the password in the connection string:
.Properties("Jet OLEDB:Database Password") = test

We use a password protected access db, and I remember an issue where you can have two different passwords on an mdb (don't quote me on that, but I know that we use this line in our code, which is identical in design to the code you posted). Give it a try and let me know if it works out.

Jack
 
Thanks for that Jack,

But I am now getting the following runtime err:

"Couldn't find installable ISAM"

Any suggestions?
 
Crap...I've never encountered that RTE before. Does it still highlight the connectoin to the db when you debug it?

I know this is probably a dumb question, but just so all bases are covered, the access db is closed when you're running the app, right?

jack
 
Jack,

sorry for delay in getting back to your question, but I was unable to look at the forum.

to answer your questions;
during debugging RTE is raised on attemping to execute the connections open method, and yes absolutely closed.

thanks again,
hugh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top