Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to relink to secure backend database

Status
Not open for further replies.

ghloid

IS-IT--Management
Mar 11, 2002
85
0
0
US
Hey all,

We have a frontend and backend database scenario here, with both databases having passwords for entry (using the simple Access 2003 database password security from the "tools" menu....no users or groups or anything). I've got the tables linked just fine, but I'm having trouble with code we use to re-link the tables automatically when the database starts up.

I believe this question has been asked many times in this forum, but I cannot find a good solution to it other than this link:


That's nice, but I'm not too familiar with ADO code referencing, and it's becoming quite difficult to get that working properly in my database.

We are currently using some simpler VBA code to re-link the backend tables. It's a public sub that looks like this:

Public Sub LinkTables(strDatabase As String)
Dim dbs As Database
Dim tdf As TableDef
Dim intI As Integer

Set dbs = CurrentDb
Set tdf = dbs.TableDefs(0)

For intI = 0 To dbs.TableDefs.Count - 1
Set tdf = dbs.TableDefs(intI)
If Len(tdf.Connect) > 0 Then
tdf.Connect = ";DATABASE=" & strDatabase
tdf.Properties = ";password=" & "go"
tdf.RefreshLink
End If
Next intI

End Sub

Now, just have to find a way to put the password option in there so that we can link successfully. Does anyone have any ideas?

I appreciate the help.

Thanks!
 
ghloid,
I believe:
Code:
        tdf.Connect = ";DATABASE=" & strDatabase & ";password=" & "go"
        tdf.RefreshLink

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Thanks for that quick reply CMP. I had to change the following on the code though:

tdf.Connect = ";DATABASE=" & strDatabase & ";pwd=" & "go"

Needed "PWD" in there instead of "password". I seem to remember seeing that somewhere else too.

Thanks for the code though. Couldn't have figured half that syntax out myself. I appreciate it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top