?
Solved

How to open password protected Access database?

Posted on 1998-09-02
18
Medium Priority
?
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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 40 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 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