Solved

Open a protected  ACCESS database in VB.

Posted on 1998-06-18
6
161 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
  • 2
  • 2
  • 2
6 Comments
 

Accepted Solution

by:
cerik earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Expert Comment

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

Author Comment

by:OSIN
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now