Arthur Fuller
fuller.artful at gmail.com
Thu Oct 18 11:52:01 CDT 2012
Lambert,
You said you copied this from an old app. So I can't figure out why it
won't compile in Access 2007. Perhaps it's because I always preface my
modules with Option Database and Option Explicit?
<vba>
' Code from an old App...
' Indexes
Dim cntKey as Integer
Dim curIdxFld As Field
Dim cntIdx As Integer
Dim curFld As Field
For cntKey = 0 To Td.Indexes.Count - 1
Set curIdx = Td.Indexes(cntKey)
'** Loop though all the fields in the current index
For cntIdx = 0 To curIdx.Fields.Count - 1
Set curIdxFld = curIdx.Fields(cntIdx)
'* is the current field part of the primary key?
If (curFld.Name = curIdxFld.Name) And (curIdx.Primary = True) Then
' log your primary key setting here
End If
Next cntIdx ' move to next field in the current index
Next cntKey ' move to next index in current table
</vba>
--
Arthur
Cell: 647.710.1314
Memory is that part of the brain that, umm, I forget, but it does something
useful, I think.
-- Arthur Fuller