Solved

Open a protected  ACCESS database in VB.

Posted on 1998-06-18
6
165 Views
Last Modified: 2011-04-14
How can I open a ACCESS database with a databate password (not the user level password) in the VB?
0
Comment
Question by:OSIN
[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
  • 2
  • 2
  • 2
6 Comments
 

Accepted Solution

by:
cerik earned 50 total points
ID: 1463639
How about...

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

The first  boolean sets exclusive to false use database, the second sets read-only false
most of this is explained in opendatabase help, but it doesn't explain the pwd stuff, I belive that we found the documentation about this at microsoft support, but the details escape me
 
Good hunting

0
 

Author Comment

by:OSIN
ID: 1463640
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

0
 

Expert Comment

by:cerik
ID: 1463641
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.
0
Technology Partners: 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!

 

Expert Comment

by:PIBM
ID: 2494690
Well what should I define ws as ??
What is db too ?
How could I call the SQL statement ?
0
 

Author Comment

by:OSIN
ID: 2499085
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
0
 

Expert Comment

by:PIBM
ID: 2501967
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 )
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying 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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

735 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