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

Open Access containing password with DAO 2

Status
Not open for further replies.

sisan

Programmer
Jan 9, 2002
39
ID
I need your help please

I have an Access MDB containing password, and in my application I open it ReadOnly with DAO(3.6)

I wrote :

Set MyDb = OpenDatabase("MyDb.mdb", , , "Uid=Admin;Pwd=MyPwd;")

but VB always told me that my password is invalid. I'm sure I gave a valid password.

Anybody can help me ? Thank you.
 
Hi!

Supply a value for all parameters, like...
Set MyDb = OpenDatabase("MyDb.mdb", False, False, "Uid=Admin;Pwd=MyPwd;")

[peace]
 
Thank you, Alphanytz.
I have tried your suggestion, but it raised the message:

Run time error 3151
ODBC--connection to 'C:\MyApp\MyDb.mdb' failed.

Any other suggestion ?
 
Sorry for that!

This should work:

Set MyDb = OpenDatabase("C:\MyApp\MyDb.mdb", False, False, "Ms Access;Uid=Admin;Pwd=MyPwd;")

MSDN says that to use the last parameter, must supply the database type first w/ semicolon then followed by other params in any order.

Hope this helps!
[peace]
 
Yes ! It works!
Thank you, Alphanytz.

2thumbsup.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top