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

OpenDatabase with Password doesnt work 1

Status
Not open for further replies.

trash00

Programmer
Jul 29, 2002
5
SK
I have problems with another simply looking thing, but dunno what a monster sleeps inside it.

I need to open a password protected database (MDB file).
The password is "dog".

I'm doing it this way:

Dim db As Database
Set db = OpenDatabase("D:\mydb.mdb", Connect:=";pwd=dog")

The opendatabase statement causes runtime error '3031' - "Not a valid password". But the password IS valid, because when I open the mdb using access and type it in, it works.
I was experimenting a little with the connect string, but no success. Where's the problem?


"I know, Access is the problem. :-("
 
Sooooo ok, noone answered, so I checked MS knowledge base and here's the answer(Excerpt from Q161016):

NOTE: Even though the Options and Read-Only arguments of the OpenDatabase method are documented in Help as being optional arguments, you must provide them when you use the Connect argument. If you use a Connect argument and you do not provide the Options and Read-Only arguments, you receive run-time error 3031 "Not a valid password." This occurs even if the password that you provided in the Connect argument is correct. If you do not need to use a Connect argument, then you can omit the Options and Read-Only arguments.

This means that those microsoft bastards can't even write a correct documentation. :-/

So it should look like this:

Dim db As Database
Set db = OpenDatabase("D:\mydb.mdb",false,false,";pwd=dog")

----------------------------------------------------------
Microsoft will kill you one day. :) Look for and support ALTERNATE solutions. M$ $uck$.

 
Yep I agree with you. Microsoft will kill us.
Had exactly the same problem. Thanks a mil for the solution. Its been a great help.

Access is the ptoblem to all our solutions.

Len
 
Yep I agree with you. Microsoft will kill us.
Had exactly the same problem. Thanks a mil for the solution. Its been a great help.

Access is the problem to all our solutions.

Len
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top