By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,306 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

connecting to password protected backend.mdb in VBA

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.