F
Fred Boer
Hello! Code I am working through is partially reproduced below...
I think I actually understand this code. Except for the "Key:=.Name" bit..
This code creates a collection which holds the names of the linked tables in
the current db, as well as the path to the back end tables. I can see this
in the immediate window, using ?tdf.name and ?tdf. That much seems clear to
me. But what is "KEY:=.Name"? Does it create an index or something?
Thanks!
Fred
P.S. I *do* try to use the help, but I just can't seem to get the hang of
how to locate something like "KEY:=...". Suggestions on ways to better
search the help are welcome! (A2K2..)
Code...
Function fGetLinkedTables() As Collection
'Returns all linked tables
Dim collTables As New Collection
Dim tdf As TableDef, db As Database
On Error GoTo Errorhandler
Set db = CurrentDb
db.TableDefs.Refresh
For Each tdf In db.TableDefs
With tdf
If Len(.Connect) > 0 Then
If Left$(.Connect, 4) = "ODBC" Then
' collTables.Add Item:=.Name & ";" & .Connect, KEY:=.Name
'ODBC Reconnect handled separately
Else
collTables.Add Item:=.Name & .Connect, Key:=.Name
End If
End If
End With
I think I actually understand this code. Except for the "Key:=.Name" bit..
This code creates a collection which holds the names of the linked tables in
the current db, as well as the path to the back end tables. I can see this
in the immediate window, using ?tdf.name and ?tdf. That much seems clear to
me. But what is "KEY:=.Name"? Does it create an index or something?
Thanks!
Fred
P.S. I *do* try to use the help, but I just can't seem to get the hang of
how to locate something like "KEY:=...". Suggestions on ways to better
search the help are welcome! (A2K2..)
Code...
Function fGetLinkedTables() As Collection
'Returns all linked tables
Dim collTables As New Collection
Dim tdf As TableDef, db As Database
On Error GoTo Errorhandler
Set db = CurrentDb
db.TableDefs.Refresh
For Each tdf In db.TableDefs
With tdf
If Len(.Connect) > 0 Then
If Left$(.Connect, 4) = "ODBC" Then
' collTables.Add Item:=.Name & ";" & .Connect, KEY:=.Name
'ODBC Reconnect handled separately
Else
collTables.Add Item:=.Name & .Connect, Key:=.Name
End If
End If
End With