[AccessD] Question about the TableDef.Fields collection

John Colby jwcolby at gmail.com
Fri Aug 26 11:58:18 CDT 2022


Autonumbers serve another purpose, speeding up joins.  Joining strings
between tables requires a visit to a library where the string is scanned
and compared to the other field byte by byte.  A long integer OTOH used a
simple equal operator on a 32 bit number.  One instruction vs potentially
hundreds.

On Fri, Aug 26, 2022 at 9:46 AM Arthur Fuller <fuller.artful at gmail.com>
wrote:

> 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
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


-- 
John W. Colby
Colby Consulting


More information about the AccessD mailing list