[AccessD] ADO Connection with password

jwcolby jwcolby at colbyconsulting.com
Tue Dec 4 10:13:22 CST 2007


ROTFL.  That is a stunner.

OK I will write this one off to "go talk to Andy" if the subject ever comes
up.  ;-)

Thanks,


John W. Colby
Colby Consulting
www.ColbyConsulting.com 
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
Sent: Tuesday, December 04, 2007 10:02 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] ADO Connection with password

Sure

Function DBPassword
DBPassword="fred"
End Function

;-)

Good eh? The only point is to have it in an MDE.

Actually I've been thinking that I might get the pw programmatically from
the connect string of an attached table but I can't decide if that's a
better or worse solution. All a bit cosmetic given the ease with which you
can get hold of a password cracker but I've a client to satisfy.

--
Andy Lacey
http://www.minstersystems.co.uk


--------- Original Message --------
From: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] ADO Connection with password
Date: 04/12/07 14:58


And will you share your function DBPassword?


John W. Colby
Colby Consulting
www.ColbyConsulting.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
Sent: Tuesday, December 04, 2007 7:41 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] ADO Connection with password

Hi JC
The change was easy once Gustav had identified what's needed. I don't have
other versions of Access setup to test though.

In function GetLockInfo()

replace

cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=" & strDb

cn2.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & strDb


with

strPassword = DBPassword()

With cn
..Provider = "Microsoft.Jet.OLEDB.4.0"
If strPassword <> "" Then
..Properties("Jet OLEDB:Database Password") = strPassword End If .Open "Data
Source=" & strDb End With

With cn2
..Provider = "Microsoft.Jet.OLEDB.4.0"
If strPassword <> "" Then
..Properties("Jet OLEDB:Database Password") = strPassword End If .Open "Data
Source=" & strDb End With

where DBPassword is my function in an MDE to return the password.

--
Andy Lacey
http://www.minstersystems.co.uk



--------- Original Message --------
From: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
To: "'Access Developers discussion and problem solving'"
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] ADO Connection with password
Date: 04/12/07 12:27


Andy,

Would you write up what you did to code to make it happen, and test it with
the later versions of Access? I can then wrap the changes into the utility
and fix whatever the "bug" might have been.


John W. Colby
Colby Consulting
www.ColbyConsulting.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
Sent: Tuesday, December 04, 2007 5:19 AM
To: Dba
Subject: Re: [AccessD] ADO Connection with password

You did it again Gustav. This did the trick beautifully. Thanks for the
millionth time for your help.

--
Andy Lacey
http://www.minstersystems.co.uk

Hi Andy

You may need first to set the Property "Jet OLEDB:Database Password" as
explained here:

http://www.asp101.com/tips/index.asp?id=98

/gustav

>>> andy at minstersystems.co.uk 03-12-2007 16:52 >>>
Hi all

Does anyone else use the code, originally from JC IIRC, which shows who is
in an MDB by looking at the LDB? Well I've been successfully using this for
years but I now need it to work for a password-protected MDB. So I took the
lines


Dim cn As New ADODB.Connection
Dim cn2 As New ADODB.Connection

cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=" & strDb

and changed them to:

cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "Data Source=" & strDb & "; Password=fred;"


but to no avail. I consistently get the message

"Cannot start your application. The workgroup information file is missing or
opened exclusively by another user."

This is A97, and I do not use Access security. If I set the code back as it
was I'm told, rightly, that I need a password but I don't seem to be able to
provide one. I guess the "workgroup information file" the message is
referring to is System.MDW but why does it have a problem with it? I've
tried copying the MDW from the System32 folder to where the MDB is. I've
tried copying the MDW from the folder where my live system lives to where
this MDB is. Neither helps. I'd appreciate any guidance on what's going on
here and what I'm doing wrong.

By the way 99.99% of my time I use DAO. This is ADO because, well because
that's the way this very clever code works. So my knowledge of ADO is very
...imited and I may therefore have made a very silly fundamental error. If
so do feel free to tell me.


--
Andy Lacey
http://www.minstersystems.co.uk


________________________________________________
Message sent using UebiMiau 2.7.2

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

________________________________________________
Message sent using UebiMiau 2.7.2

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

________________________________________________
Message sent using UebiMiau 2.7.2

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list