Link to home
Start Free TrialLog in
Avatar of OSIN
OSIN

asked on

Open a protected ACCESS database in VB.

How can I open a ACCESS database with a databate password (not the user level password) in the VB?
ASKER CERTIFIED SOLUTION
Avatar of cerik
cerik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of OSIN
OSIN

ASKER

The statement is correct! However the ture is the first False in your statement is the "Option" and the second is the "Read Only". It doesn't matter you open the database in exclusive mode  or not. But you have to put something in it. The Opendatabase fail me previous because I use this statement

Set db = ws.OpenDatabase("C:/myDirectory/mydbfile.mdb", , , "MS Access;PWD=mypassword")

You can put anything in the "Option" since you are not using the  ODBC connection. But I use dbDriverNoPrompt. It make more sense. Here is my final version

Set db = ws.OpenDatabase("C:/myDirectory/mydbfile.mdb",  dbDriverNoPromp,  False, "MS Access;PWD=mypassword")

for share mode and

Set db = ws.OpenDatabase("C:/myDirectory/mydbfile.mdb",  dbDriverNoPromp, Ture, "MS Access;PWD=mypassword")

for exclusive mode


Thanks and regards -- Oliver

Yeah sorry 'bout that,

I got what those two bool values where for using the old office e-mail system of yelling across the room, and they got mixed up, but as you say the important thing is to have them there.
Well what should I define ws as ??
What is db too ?
How could I call the SQL statement ?
Avatar of OSIN

ASKER

1. ws is defined as the Workspace, you can use the default workspace (just remove the "ws." prefix.
2. db is defined as the Database.
3. It depend on how you want to access the data. The simplest way may be using the Recordset

Dim rs As Recordset
set rs = db.OpenRecordset ("Your SQL Statement")

Regards -- Oliver
Thanks :)
I forgot to post that I had found the answer. We have to set a link to the definitions.. that's what was missing ( I don't know the exact words in english, sorry )