Solved

How to access password protected MS Access database.

Posted on 2002-06-06
8
135 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:anilgupt
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Accepted Solution

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

Author Comment

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

Expert Comment

by:harsh008_k
Comment Utility
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
Comment Utility
Harsha,
What do u want to say to me. I am not getting your point.
+Anil
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now