469,271 Members | 876 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

connecting to password protected backend.mdb in VBA

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
Nov 12 '05 #1
1 3576
Chris wrote:
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?


-----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-----

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by ifeoma | last post: by
3 posts views Thread by Tony | last post: by
4 posts views Thread by Geir Baardsen | last post: by
6 posts views Thread by Mike | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.