Connecting Tech Pros Worldwide Forums | Help | Site Map

connecting to password protected backend.mdb in VBA

Chris
Guest
 
Posts: n/a
#1: Nov 12 '05
I have a frontend that has some tables which are linked to a backend.
Now I want to make the backend password protected and when I try to
run it password protected I can't open it. In the first form that
opens in the front end, I added the following to the form_open event:

Dim cnn As ADODB.connection

Set cnn = New ADODB.connection
cnn.Provider = "Microsoft.Jet.OLEDB.4.0"
cnn.Properties("Data Source") = "C:\backend.mdb"
cnn.Properties("Jet OLEDB:Database Password") = "password"
cnn.Open
Set cnn = Nothing

It seems like it is running the code but not opening up the links or
not keeping the connection open. After I run this code and I click on
one of the linked tables I get the message "Not a valid password". How
can I get it to work as if there was no password on the backend?

Thanx,
Chris

MGFoster
Guest
 
Posts: n/a
#2: Nov 12 '05

re: connecting to password protected backend.mdb in VBA


Chris wrote:
[color=blue]
> I have a frontend that has some tables which are linked to a backend.
> Now I want to make the backend password protected and when I try to
> run it password protected I can't open it. In the first form that
> opens in the front end, I added the following to the form_open event:
>
> Dim cnn As ADODB.connection
>
> Set cnn = New ADODB.connection
> cnn.Provider = "Microsoft.Jet.OLEDB.4.0"
> cnn.Properties("Data Source") = "C:\backend.mdb"
> cnn.Properties("Jet OLEDB:Database Password") = "password"
> cnn.Open
> Set cnn = Nothing
>
> It seems like it is running the code but not opening up the links or
> not keeping the connection open. After I run this code and I click on
> one of the linked tables I get the message "Not a valid password". How
> can I get it to work as if there was no password on the backend?[/color]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The reason it is not keeping the connection open is that you are closing
the connection: "Set cnn = Nothing" closes the connection.

Guess:

Try declaring (Dim) the connection variable in the Declarations section
of the form's module & run the above code (excluding the Dim cnn ... &
Set cnn = nothing) in the Form_Open procedure. In the Form_Close
procedure run the Set cnn = Nothing.

Another Guess:

The connection string of linked tables contains the password in plain
text. Using DAO you can programatically change the linked TableDefs'
connection strings to include the password (;Pwd=password) &
..RefreshLink the TableDef.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQH2XDYechKqOuFEgEQJy2gCgvZGRi5h3BtUDlLC2o08L8Z Fv4FAAnRCE
4cYtkXrXaMeskjSS0xu614WE
=VluH
-----END PGP SIGNATURE-----

Closed Thread


Similar Microsoft Access / VBA bytes