[AccessD] Question about the TableDef.Fields collection

Arthur Fuller fuller.artful at gmail.com
Fri Aug 26 08:46:08 CDT 2022


Like most Access programmers, I use AutoNumber fields as Primary Keys
whenever it makes sense. However, it doesn't always make sense, and this is
particularly so when the table of interest contains a relatively small
number of rows. The reason I say this is because using an AutoNumber as the
PK demands additional logic, to prevent otherwise equal rows from being
added. For example, in a table of Countries, using an AutoNumber as the PK
does not prevent the addition of country names that would duplicate an
existing row. You could add Israel a dozen times, with each row having an
AutoNumber. That said, I can think of no reason to have an AutoNumber in a
table unless it is the PK.

But in tables containing no AutoNumber field, is there a Field attribute
that identifies the PK of the table of interest?

Thanks in advance.

-- 
Arthur


More information about the AccessD mailing list