[AccessD] Question about the TableDef.Fields collection

Gustav Brock gustav at cactus.dk
Fri Aug 26 09:18:29 CDT 2022


Hi Arthur

A table of countries you would maintain following the ISO 3166-1 standard, not just add an arbitrary record now and then:

https://en.wikipedia.org/wiki/ISO_3166-1

Because of the three sets of unique text codes, a numeric autonumber could be useful as your own unique reference.

/gustav

-----Oprindelig meddelelse-----
Fra: AccessD <accessd-bounces+gustav=cactus.dk at databaseadvisors.com> På vegne af Arthur Fuller
Sendt: 26. august 2022 15:46
Til: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Emne: [AccessD] Question about the TableDef.Fields collection

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