Susan Harkins
ssharkins at gmail.com
Wed Oct 22 19:21:10 CDT 2008
Here's what I ended up with, but seems little more complex than it ought to. Function ListPK(tbl As String) 'List primary keys for passed table. 'Must reference ADOX library: 'Microsoft ADO Ext. 2.8 for DDL and Security. Dim cat As New ADOX.Catalog Dim tblADOX As New ADOX.table Dim idxADOX As New ADOX.Index Dim colADOX As New ADOX.Column Dim keyADOX As New ADOX.key cat.ActiveConnection = CurrentProject.AccessConnection For Each tblADOX In cat.Tables If tblADOX.Name = tbl Then If tblADOX.Indexes.Count <> 0 Then For Each idxADOX In tblADOX.Indexes With idxADOX If .PrimaryKey Then For Each colADOX In .Columns Debug.Print colADOX.Name Next End If End With Next Else Debug.Print "No primary key" End If End If Next End Function > Here's a little snippet of code that you should be able to figure it out > from > > For cntFlds = 0 To curTbl.Fields.count - 1 > 'If Left(curFld.Name, 4) = "bCur" Then Stop > Set curFld = curTbl.Fields(cntFlds)