Charlotte Foust
charlotte.foust at gmail.com
Thu Oct 18 12:08:10 CDT 2012
That's your problem, Arthur. You're using curIdx in the code but it isn't specifically dimmed. Charlotte On Thu, Oct 18, 2012 at 9:52 AM, Arthur Fuller <fuller.artful at gmail.com>wrote: > 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 > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >