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