Re: Coercing AutoNumber Value?



On Jun 21, 5:33 pm, PeteCresswell <PeteCr...@xxxxxxxxx> wrote:
Got a table with "RecordID"=AutoNumber=PrimaryKey.

Call it "tblIssuerRating".

Ran a query that appends to that table from a work table.

Inadvertantly appended from the work table's "RecordID", which was not
autonumber and, in fact, contained a zero.

The query ran successfully and I would up with a tblIssuerRating
record where .RecordID.Value=0.

After that, tblIssuerRating's autonumber increment was messed up: kept
trying to start with RecordID=1.

I fixed the offending query, and all is well.

But it doesnt' seem like JET should allow something like this to
happen in the first place.

Should this really be possible?

My first question to you would be "why do you want to do this". It
APPEARS that you may be falling into the trap of thinking that an
incremental autonumber field can be used as a record number when in
fact it 100% CANNOT be relied upon to do that. Autonumber is NOT
intended to be a record number or to be able to count records or
anything else what so ever. It is merely a way to give a unique value
to a field automatically. It has ZERO use for tracking ANYTHING. If
you are trying to use this autonumber field for ANYTHING meaningful at
all, you are heading for a database that will become unusable in short
order.

.



Relevant Pages

  • Re: "Indexed or Primary Key cannot contain a Null value" / Autonum
    ... It is bound to a query, but that query only draws from one table. ... or in the AutoNumber field if you open the table in design view? ... I click OK on the error message box, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Dear Microsoft: re: Error 3090...
    ... > When attempting to import a query as a table, ... > "Resultant table not allowed to have more than one AutoNumber field. ... The query you are importing has multiple Autonumber ...
    (microsoft.public.access.queries)
  • Re: Specific "auto numbers" possible?
    ... ineveitably arise when using autonumber. ... Create and run an append query to append the temporary table to the ... New on the Database window toolbar. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Specific "auto numbers" possible?
    ... ineveitably arise when using autonumber. ... Create and run an append query to append the temporary table to ... New on the Database window toolbar. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Specific "auto numbers" possible?
    ... ineveitably arise when using autonumber. ... Create and run an append query to append the temporary table to the ... New on the Database window toolbar. ...
    (microsoft.public.access.tablesdbdesign)