For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > July 2006 > Accessing mdb file via VB code









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Accessing mdb file via VB code
AK

2006-07-03, 6:56 pm

Hello All,


After my earlier post concerning Access database LockDown, I put on my
training wheels and started to "ride". I did not get very far!

I started by adding a password to my test DB by setting it by using
Tools|Security

Then I changed my Connection.Open Method statements to add the UserID and
Passwords.
My pertinent connection statements in my Conection.Open Method are as
follows:



strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data " & _
"Source=" & m_sDataFile &
" ;Mode=ReadWrite;USERID=Administrator;Pas
sword=testing;"

m_adoConnection.Open strConn




When I run this I get the following message:

Run time error '-2147217843(80040e4d)'
Cannot Start your application. The workgroup information file is
missing or open exclusively by another user.


I did not see in my O'Reilly ADO guide that I needed to specify an mdw file,
but certainly I am missing something. My testing computer is set up with
just 1 user (Administrator), and the only thinng I changed from the default
Access installation is that I added the password.


What am I doing wrong?

AK




Jeff Johnson

2006-07-03, 6:56 pm

"AK" <nospam@satx.rr.com> wrote in message
news:%23AWrUArnGHA.5056@TK2MSFTNGP02.phx.gbl...

> I started by adding a password to my test DB by setting it by using
> Tools|Security
>
> Then I changed my Connection.Open Method statements to add the UserID and
> Passwords.


If all you did was add a "database password" then "User ID" (note the space)
and "Password" are not the keywords you want; you want "JetOLEDB:Database
Password".


Ralph

2006-07-03, 6:56 pm


"AK" <nospam@satx.rr.com> wrote in message
news:%23AWrUArnGHA.5056@TK2MSFTNGP02.phx.gbl...
> Hello All,
>
>
> After my earlier post concerning Access database LockDown, I put on my
> training wheels and started to "ride". I did not get very far!
>
> I started by adding a password to my test DB by setting it by using
> Tools|Security
>
> Then I changed my Connection.Open Method statements to add the UserID and
> Passwords.
> My pertinent connection statements in my Conection.Open Method are as
> follows:
>
>
>
> strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data " & _
> "Source=" & m_sDataFile &
> " ;Mode=ReadWrite;USERID=Administrator;Pas
sword=testing;"
>
> m_adoConnection.Open strConn
>
>
>
>
> When I run this I get the following message:
>
> Run time error '-2147217843(80040e4d)'
> Cannot Start your application. The workgroup information file is
> missing or open exclusively by another user.
>
>
> I did not see in my O'Reilly ADO guide that I needed to specify an mdw

file,
> but certainly I am missing something. My testing computer is set up with
> just 1 user (Administrator), and the only thinng I changed from the

default
> Access installation is that I added the password.
>
>
> What am I doing wrong?
>
> AK
>


If you get this message then you have to supply a mdw file location...
= "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=pathtodb.mdb;" & _
"Jet OLEDB:System Database=<mdw_file_name>.mdw"

Whether you want to do that or not may require a different approach.

Jet/MSAccess security is a bit convoluted when viewed for the first time. It
also doesn't help that the Security Wizards have subtle differences between
versions. (The essentials are the same, but defaults and expectations will
differ, and surprises are just around each corner.)

In addition to your ADO Guide you need to shop for a book covering your
version of MSAccess that details Security (Jet/Database, and User-Level).
The general MS help files are quite adequate - once you understand what in
the hell they are talking about. <g>

Other 'Gotchas' - you often have to completely shut-down VB and MSAccess
when making any 'security' changes. Some Security Wizards create new
workgroup files and database copies without you realizing it. (Watch out for
quick clicks on OK buttons. <g> ) Save every scrap of information (passwords,
names, IDs) you enter into Security/Tools->utilities - it is quite possible
to lock yourself out.

Back up, back up, back up...

hth
-ralph


Ralph

2006-07-03, 6:56 pm


"Jeff Johnson" <i.get@enough.spam> wrote in message
news:%23vots6rnGHA.1664@TK2MSFTNGP05.phx.gbl...
> "AK" <nospam@satx.rr.com> wrote in message
> news:%23AWrUArnGHA.5056@TK2MSFTNGP02.phx.gbl...
>
and[color=darkred]
>
> If all you did was add a "database password" then "User ID" (note the

space)
> and "Password" are not the keywords you want; you want "JetOLEDB:Database
> Password".
>


Doh!

By using UserID and Password in the connection string one is telling Jet
that you intend to invoke User-Level security, not Database security, but
the 'current' mdw doesn't support that request.

-ralph
[sometimes one can have too much coffee! <g>]


AK

2006-07-03, 6:56 pm

Thanks guys, your info was good and I was able to get one of my forms up and
running, but then I encountered the error message "Unable to find
installable ISAM" when a connection to my database was attempted on another
form.( Man , talk about learing to ride your bike while trying to dodge
bricks!)

Googled this and went to MS KB where it talks about such a message but the
info they give (at KB # 283881) appears to deal with Access 2003 (which is
what I am using) but then goes on in the body to indicate that I am
supposed to look for a JET 3 file ! My provider is Jet 4.0 not Jet 3.


I am not afraid to edit the registry (Well I kinda sorta am but still can
do it if need be) but I am unclear if this KB article applies to me. All of
my connections are to the same DB and the conection string is the same:

Private m_adoConnection As ADODB.Connection

Dim strConn As String

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data " & _
"Source=" & m_sDataFile & ";" & _ 'm_sDatafile is my path
to my Database
"Jet OLEDB:Database Password = MyPassword; &
Mode=ReadWrite;"

m_adoConnection.Open strConn

What gives now??

Any


"Ralph" <nt_consulting64@yahoo.com> wrote in message
news:P5ednVKYeI7F0DTZnZ2dnUVZ_u6dnZ2d@ar
kansas.net...
>
> "Jeff Johnson" <i.get@enough.spam> wrote in message
> news:%23vots6rnGHA.1664@TK2MSFTNGP05.phx.gbl...
> and
> space)
>
> Doh!
>
> By using UserID and Password in the connection string one is telling Jet
> that you intend to invoke User-Level security, not Database security, but
> the 'current' mdw doesn't support that request.
>
> -ralph
> [sometimes one can have too much coffee! <g>]
>
>



Ralph

2006-07-03, 9:55 pm


"AK" <nospam@satx.rr.com> wrote in message
news:%23T1ULFvnGHA.4648@TK2MSFTNGP05.phx.gbl...
> Thanks guys, your info was good and I was able to get one of my forms up

and
> running, but then I encountered the error message "Unable to find
> installable ISAM" when a connection to my database was attempted on

another
> form.( Man , talk about learing to ride your bike while trying to dodge
> bricks!)
>
> Googled this and went to MS KB where it talks about such a message but the
> info they give (at KB # 283881) appears to deal with Access 2003 (which is
> what I am using) but then goes on in the body to indicate that I am
> supposed to look for a JET 3 file ! My provider is Jet 4.0 not Jet 3.
>
>
> I am not afraid to edit the registry (Well I kinda sorta am but still can
> do it if need be) but I am unclear if this KB article applies to me. All

of
> my connections are to the same DB and the conection string is the same:
>
> Private m_adoConnection As ADODB.Connection
>
> Dim strConn As String
>
> strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data " & _
> "Source=" & m_sDataFile & ";" & _ 'm_sDatafile is my

path
> to my Database
> "Jet OLEDB:Database Password = MyPassword; &
> Mode=ReadWrite;"
>
> m_adoConnection.Open strConn
>
> What gives now??
>
> Any
>

<snipped>


If the situation in the KB article is not related to your problem (you are
not using an ISAM driver) then you have the "bogus" form of that error.
There are several causes and respective solutions that will vary from the
simple to a drift toward madness.

Are you using the ADO or DAO data access libraries?

If you are using ADO and ADO providers are you by any chance using a "DAO"
control (DataGrid) on this second form?
If so you will need to make sure the DAO components and typelib are
installed and registered. You should find them in Progr~Files\Common
Files\Microsoft Shared\DAO. This is the simple fix.
[Occasionally these files are not correctly installed or registered on WinXP
boxes with Jet4. Also be aware - the problem is not that you are using or
accessing DAO from your program, the problem is that these controls need the
DAO to be properly installed. Therefore this has nothing to do with project
references.]

If that doesn't solve the problem then try this...
http://support.microsoft.com/defaul...kb;en-us;299457
Make sure you have only one MSVBVM60.dll on your machine.

If that doesn't seem to resolve the problem, then it is caused by another
miss-match of components. If you are still having trouble report back with
all the specifics of your problem domain. (Data Access Libraries, OS
version, Jet, MDAC, etc.) You can fiddle away one by one, or simply burn
everything MDAC/Jet down to the water line and start over.

hth
-ralph


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com