Link to home
Start Free TrialLog in
Avatar of anilgupt
anilgupt

asked on

How to access password protected MS Access database.

I have a MS Access database having password protected. I want to access this database by using Visual Basic ADO. How can i access this databse. I am able to access this databse if it is not password protected. Please let me know as soon as possible.
Thanks..
+Anil
Avatar of Chandramouli k
Chandramouli k
Flag of India image

if u use dsn :
Cn.Open "DSN=<dsnname>;Uid=<Uid>;Pwd=<Password>"

if dsnless connection

Cn.Open "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & app.path & "\database.mdb;Pwd=<password>"

Avatar of anilgupt
anilgupt

ASKER

If you don't mind, Please try this yourself. Actually i tried it and it doesn't work.
+Anil
hi anil,
what kcm has given is correct

example is like this

Dim cnInvoice as adodb.connection

Set cnInvoice = New ADODB.Connection

cnInvoice.Open "dsn=Sankhla;uid=;pwd=anil;"

to create a dsn
1)choose odbc from control panel.
2)choose userdsn,then select add
3)choose Microsoft Access Driver(*.mdb)
5)Select Finish
6)Give a name to your datasource(dsn)
7)Select the Database

and use the same dsn in your code and the password
it should run

good luck anil

Harsha
Hi Harsha,
Sorry, i forget to mention about DSN less connection. Actually I need help in accessing databse using dsn less connection only.
You are right for DSN connection.

+Anil
ASKER CERTIFIED SOLUTION
Avatar of Benjy
Benjy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Benjy,
You gave the right solution of this problem.
Thanks,
+Anil
anil,
remember to reciprocate the efforts of others as well.They 2 have invested their time.nobody will respond to u if write a comment like that and dont take this forum to be for granted
Harsha,
What do u want to say to me. I am not getting your point.
+Anil