Moin
asked on
How to open password protected Access database?
Hi, I want to open a password protected MS Access file from VB. How can I do that without using ODBC.
Waiting for help...
Waiting for help...
ASKER
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.
set godbHMC = opendatabase(dbPath)
How can I do this.
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.
You have to create a workspace other than the default, with only the password.
ASKER
But I have just password protected the database, I have no userName for the database.
In that case I think you have to use the default user (probably admin). Otherwise, create a user.
Answer also to me, please.
ASKER
My problem is still unsolved. Please tell me in detail ad each and every step to do this.
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(d bPath)
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("
"BillClinton", "Monica", dbUseJet)
Third : Open your database :
set godbHMC = gwWorkSpace.opendatabase(d
ASKER
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?
"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?
Wich version of Access do you use? If it is access 2.0, it is a MDA file.
ASKER
It is Access 97.
Is your .MDW file exists?
ASKER
Yes it exists in "C:\winnt\system32\system. mdw"
ASKER
Yes it exists in "C:\winnt\system32\system. mdw"
Are you sure that Access is not open when you test your application?
ASKER
yes, it's not open
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, that's great.
'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("
Trim(txtUserName.Text), Trim(txtPassword.Text), dbUseJet)