Solved

How to access password protected MS Access database.

Posted on 2002-06-06
8
137 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:anilgupt
8 Comments
 
LVL 5

Expert Comment

by:kcm76
ID: 7061284
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>"

0
 

Author Comment

by:anilgupt
ID: 7061300
If you don't mind, Please try this yourself. Actually i tried it and it doesn't work.
+Anil
0
 
LVL 1

Expert Comment

by:harsh008_k
ID: 7061327
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
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:anilgupt
ID: 7061331
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
0
 
LVL 1

Accepted Solution

by:
Benjy earned 50 total points
ID: 7061432
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=locationpath\file.mdb" & _
         "Jet OLEDB:Database Password=mypasword;"
0
 

Author Comment

by:anilgupt
ID: 7061456
Hi Benjy,
You gave the right solution of this problem.
Thanks,
+Anil
0
 
LVL 1

Expert Comment

by:harsh008_k
ID: 7061542
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
0
 

Author Comment

by:anilgupt
ID: 7061549
Harsha,
What do u want to say to me. I am not getting your point.
+Anil
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question