I've got a project that pulls out tables, fields, indexed fields, and primary keys from a chosen database. I've got most working but am having some problems with my primary keys. I'm not sure how to access my primary key. One example is in my table CheckRequest the primary key is CheckReqKey. In my loop below when idx.Name is CheckReqKey, the primary key, it isn't recognized. It is only when idx.Name is "PrimaryKey" that idx.Primary is true. In my debug window I can expand out idx and find that when idx.Name is "PrimaryKey" by continuing to expand I find that idx-fields-item1 has a value name which equals CheckReqKey. My problem is this logically makes sense but is there a way to access this value in my code?
I tried: idx.Fields.Item1.Name with no luck??? Please help if you have experience with indexes. Thanks in advance!!!
For Each idx In tblT.Indexes
If idx.Primary Then
Debug.Print idx.Name, idx.Foreign, idx.Primary, idx.Unique, idx.Required
indexName = idx.Primary
If Not idx.Name = "PrimaryKey" Then
Form_frmDatabaseInfo.cbxPrimaryKey.Value = idx.Name
End If
End If
Next idx
I tried: idx.Fields.Item1.Name with no luck??? Please help if you have experience with indexes. Thanks in advance!!!
For Each idx In tblT.Indexes
If idx.Primary Then
Debug.Print idx.Name, idx.Foreign, idx.Primary, idx.Unique, idx.Required
indexName = idx.Primary
If Not idx.Name = "PrimaryKey" Then
Form_frmDatabaseInfo.cbxPrimaryKey.Value = idx.Name
End If
End If
Next idx