We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How to open password protected Access database?

Moin
Moin asked
on
Medium Priority
338 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...
Comment
Watch Question

Commented:
  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)

Author

Commented:
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.

Commented:
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.

Author

Commented:
But I have just password protected the database, I have no userName for the database.

Commented:
In that case I think you have to use the default user (probably admin). Otherwise, create a user.

Commented:
Answer also to me, please.

Author

Commented:
My problem is still unsolved. Please tell me in detail ad each and every step to do this.

Commented:
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)
 

Author

Commented:
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?

Commented:
Wich version of Access do you use? If it is access 2.0, it is a MDA file.

Author

Commented:
It is Access 97.

Commented:
Is your .MDW file exists?

Author

Commented:
Yes it exists in "C:\winnt\system32\system.mdw"

Author

Commented:
Yes it exists in "C:\winnt\system32\system.mdw"

Commented:
Are you sure that Access is not open when you test your application?

Author

Commented:
yes, it's not open
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Yes, that's great.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.