Solved

How to open password protected Access database?

Posted on 1998-09-02
18
316 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 VB code 9 115
MsgBox 2 54
Notepad++ how to remove delimiter : from beggning of the line? 3 105
Add a task in Outlook from access 11 39
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

770 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