Need some help finding the names of the indexed fields in a table def.
Following code gets me into the database definitions, but finding name(s) of indexed fields is eluding me.
Option Compare Database
Option Explicit
Dim db As Database
Dim tbl As tabledef
Dim fld As Field
Dim idx As Index
Dim strnm As String
Dim i As Integer, iTableCount As Integer
Dim tdfCurrent As tabledef
Dim strIndexNames as String
Sub test()
Set db = CurrentDb
iTableCount = db.TableDefs.Count
'For each Table,
For i = 0 To (iTableCount - 1)
Set tdfCurrent = db.TableDefs(i)
'Exclude system tables
If Left(tdfCurrent.Name, 4) <> "MSys" Then
??????
HERE IS WHERE I NEED HELP. HOW DO I READ THROUGH TABLE DEF'S INDEX COLLECTION AND RETRIEVE NAME. WANT TO PLACE IN:
strIndexNames = idx.fld.name
End If '
Next i
End Sub
Following code gets me into the database definitions, but finding name(s) of indexed fields is eluding me.
Option Compare Database
Option Explicit
Dim db As Database
Dim tbl As tabledef
Dim fld As Field
Dim idx As Index
Dim strnm As String
Dim i As Integer, iTableCount As Integer
Dim tdfCurrent As tabledef
Dim strIndexNames as String
Sub test()
Set db = CurrentDb
iTableCount = db.TableDefs.Count
'For each Table,
For i = 0 To (iTableCount - 1)
Set tdfCurrent = db.TableDefs(i)
'Exclude system tables
If Left(tdfCurrent.Name, 4) <> "MSys" Then
??????
HERE IS WHERE I NEED HELP. HOW DO I READ THROUGH TABLE DEF'S INDEX COLLECTION AND RETRIEVE NAME. WANT TO PLACE IN:
strIndexNames = idx.fld.name
End If '
Next i
End Sub