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

Reconnect to DB back end - password

P: n/a
MS
Access 97

I have an Access FE that reconnects "automatically" regardless of whether
the FE or BE have been moved to another folder. To achieve this, I have used
Peter Vukovic's ( 10*********@compuserve.com ) excellent solution. As long
as they are both in the same folder, they will reconnect.

Function Reconnect()

' Bits snipped here for clarity

For i = 0 To db.TableDefs.Count - 1
If db.TableDefs(i).Connect <> " " Then
source = Mid(db.TableDefs(i).Connect, 11)
For j = Len(source) To 1 Step -1
If Mid(source, j, 1) = Chr(92) Then
dbsource = Mid(source, j + 1, Len(source))
source = Mid(source, 1, j)
If source <> path Then
db.TableDefs(i).Connect = ";Database=" + path +
dbsource
db.TableDefs(i).RefreshLink
End If
Exit For
End If
Next
End If
Next

End Function

The problem I have ATM the moment, is if the BE is password protected, how
do you send the password to it to enable reconnection? I've tried
everything - I must be missing something.
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tried this?

db.TableDefs(i).Connect = ";Database=" + path + dbsource & _
";PWD=password"

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

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

iQA/AwUBQgmGJIechKqOuFEgEQLqqwCfeHSLNcCkpaCwpP7IDbhkbK 60JlIAoKcm
YiuTAWE2MlxdpeeCVbU7Kw6i
=ixN4
-----END PGP SIGNATURE-----
MS wrote:
Access 97

I have an Access FE that reconnects "automatically" regardless of whether
the FE or BE have been moved to another folder. To achieve this, I have used
Peter Vukovic's ( 10*********@compuserve.com ) excellent solution. As long
as they are both in the same folder, they will reconnect.

Function Reconnect()

' Bits snipped here for clarity

For i = 0 To db.TableDefs.Count - 1
If db.TableDefs(i).Connect <> " " Then
source = Mid(db.TableDefs(i).Connect, 11)
For j = Len(source) To 1 Step -1
If Mid(source, j, 1) = Chr(92) Then
dbsource = Mid(source, j + 1, Len(source))
source = Mid(source, 1, j)
If source <> path Then
db.TableDefs(i).Connect = ";Database=" + path +
dbsource
db.TableDefs(i).RefreshLink
End If
Exit For
End If
Next
End If
Next

End Function

The problem I have ATM the moment, is if the BE is password protected, how
do you send the password to it to enable reconnection? I've tried
everything - I must be missing something.

Nov 13 '05 #2

P: n/a
MS

"MGFoster" <me@privacy.com> wrote in message
news:KC*****************@newsread1.news.pas.earthl ink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tried this?

db.TableDefs(i).Connect = ";Database=" + path + dbsource & _
";PWD=password"


Doesn't seem to to do the trick
Nov 13 '05 #3

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the security on the db is just "Database Password" then something
like this should work as the connection string:

MS Access;PWD=junk;DATABASE=C:\temp\tempDB.mdb

Did you remember to refresh the link after setting the connect string?

db.TableDefs(i).RefreshLink

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

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

iQA/AwUBQgmVoYechKqOuFEgEQJ8YACg8VVA034nhk+9NqdFaoQKmZ Q+08UAoMnn
8/JA2jYFXHlfBpCV2kQM9hk3
=jiVK
-----END PGP SIGNATURE-----
MS wrote:
"MGFoster" <me@privacy.com> wrote in message
news:KC*****************@newsread1.news.pas.earthl ink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tried this?

db.TableDefs(i).Connect = ";Database=" + path + dbsource & _
";PWD=password"

Doesn't seem to to do the trick

Nov 13 '05 #4

P: n/a
MS

"MGFoster" <me@privacy.com> wrote in message
news:FA*****************@newsread1.news.pas.earthl ink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If the security on the db is just "Database Password" then something
like this should work as the connection string:

MS Access;PWD=junk;DATABASE=C:\temp\tempDB.mdb

Did you remember to refresh the link after setting the connect string?

db.TableDefs(i).RefreshLink


Actually, it turns out that......

db.TableDefs(i).Connect = ";Database=" + path + dbsource & ";PWD=password"

.....does work.

The problem I had was wierd. Even though I relinked the FE with the password
protected data, because in my code...

source <> path

....was returning true - i.e. both were in the original folder, the
linking/password code didn't work for some reason.

But when I moved both files to a new folder, source <> path returns false
meaning they've been moved, the code works.

With subsequent moving of the files, or leaving the files, the linking code
works every time.

So, it kind of does what I want. I just need to move the files to a folder
that is different to the one where the BE is originally linked, to
"initialise" things and there's no problems. A bit of a hack way, for sure,
but I get the result I want.

So thanks heaps!

Cheers!


Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.