Solved

How to open password protected Access database?

Posted on 1998-09-02
18
315 Views
Last Modified: 2010-04-30
Hi, I want to open a password protected MS Access file from VB. How can I do that without using ODBC.
Waiting for help...
0
Comment
Question by:Moin
18 Comments
 
LVL 14

Expert Comment

by:waty
ID: 1432499
  DBEngine.SystemDB = "C:\yoursystemmdw.mdw"

   'Create a new workspace object
   'gwWorkSpace is a Global variable where you put in the module
   'txtUserName and txtPassword are fields on Logon screen.
   '
   Set gwWorkSpace = DBEngine.CreateWorkspace("New", _
   Trim(txtUserName.Text), Trim(txtPassword.Text), dbUseJet)

0
 

Author Comment

by:Moin
ID: 1432500
I can't understand your answer. What if I don't want to use workspace and if I am opening database directly using opendatabase. e.g.,
set godbHMC = opendatabase(dbPath)
How can I do this.

0
 
LVL 14

Expert Comment

by:waty
ID: 1432501
When you open directly your DB, you use a default workspace.

You have to create a workspace other than the default, with only the password.
0
 

Author Comment

by:Moin
ID: 1432502
But I have just password protected the database, I have no userName for the database.
0
 
LVL 14

Expert Comment

by:waty
ID: 1432503
In that case I think you have to use the default user (probably admin). Otherwise, create a user.
0
 
LVL 1

Expert Comment

by:soeding
ID: 1432504
Answer also to me, please.
0
 

Author Comment

by:Moin
ID: 1432505
My problem is still unsolved. Please tell me in detail ad each and every step to do this.
0
 
LVL 14

Expert Comment

by:waty
ID: 1432506
First : Create a user in your Access DB with a password :
         User     = "BillClinton"
         Password = "Monica"

Second : You have to create an new workspace :
   DBEngine.SystemDB = "C:\yoursystemmdw.mdw"

   'Create a new workspace object
   Set gwWorkSpace = DBEngine.CreateWorkspace("New", _
   "BillClinton", "Monica", dbUseJet)

Third : Open your database :
   set godbHMC = gwWorkSpace.opendatabase(dbPath)
 

0
 

Author Comment

by:Moin
ID: 1432507
When I use your suggested answer, I get the error
"Can't start your application. The workgroup information file is missing or opened exclusively by another user."
In my case none of the above situation exists.
What should I do now?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 14

Expert Comment

by:waty
ID: 1432508
Wich version of Access do you use? If it is access 2.0, it is a MDA file.
0
 

Author Comment

by:Moin
ID: 1432509
It is Access 97.
0
 
LVL 14

Expert Comment

by:waty
ID: 1432510
Is your .MDW file exists?
0
 

Author Comment

by:Moin
ID: 1432511
Yes it exists in "C:\winnt\system32\system.mdw"
0
 

Author Comment

by:Moin
ID: 1432512
Yes it exists in "C:\winnt\system32\system.mdw"
0
 
LVL 14

Expert Comment

by:waty
ID: 1432513
Are you sure that Access is not open when you test your application?
0
 

Author Comment

by:Moin
ID: 1432514
yes, it's not open
0
 

Accepted Solution

by:
azupancic earned 10 total points
ID: 1432515
In order to open a password protected database via DAO, you need to supply all the information in the connect string when you open the database.  The connect string is semi-colon delimited, but what help doesn't tell you, is that even though Access is the default db type, you don't supply that portion of the connect string, i.e, you omit it, thus beginning your connect string with a semi-colon.

The sample below illustrates this:

Set db = OpenDatabase("MyDB.MDB", False, False, ";pwd=password")

Hope this helps.
0
 

Author Comment

by:Moin
ID: 1432516
Yes, that's great.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Spreadsheet - Send email if certain value is selected. 14 85
Vb.net 2008 2 56
How to compare ms sql hashbytes results within vb6 5 51
TT Auto Dashboard 13 79
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

932 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

10 Experts available now in Live!

Get 1:1 Help Now