UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Access Id Field, Access 2010    
 
   
Surico
post Mar 24 2017, 05:57 AM
Post#1



Posts: 47
Joined: 22-August 16



Hi Everyone,

I have a quick query regarding this field, from my understand its an automatic incremental function by 1 every time you enter a new entry, and it is working no problem for me but I have noticed looking at my table of data that it runs from 1 to 80 and then skips 81 and 82 and goes onto 83 as the next entry. I have no delete buttons on my forms and I have deleted any records but I have edited some existing ones but surely that shouldn't effect it?

It is working but I'm wondering is this a sign of a problem and should I be worried maybe?
Go to the top of the page
 
BuzyG
post Mar 24 2017, 06:13 AM
Post#2



Posts: 338
Joined: 20-September 12
From: Cornwall UK


When using Auto number, access increments from the last new record. It's doesn't go back and look for gaps in the sequence and then use them. Therefore your sequence shows two records have been deleted. How that happened may or may not indicate that you have a problem.

--------------------
Live to Surf
Go to the top of the page
 
LPurvis
post Mar 24 2017, 06:31 AM
Post#3


UtterAccess Editor
Posts: 16,086
Joined: 27-June 06
From: England (North East / South Yorks)


Hi

Just to clarify, it's not necessarily the case that the records were deleted as such.
Access' autonumber differs from the SQL Identity (for example) in that it supplies the new autonumber value for a new record as it's being entered (once dirtied). If that record isn't committed, the autonumber doesn't rollback. So you'll have a gap in the sequence.

Of course, the real advice is to not worry about it. The values are intended only as a means of providing an automatic (generally unique) value to act as a non-natural primary key. Assigning greater meaning to them is generally not ideal.
(Though I have for certain applications and don't berate those that do... but equally that's with adding rows very specifically and still, not really caring about sequentiaity.)

Cheers

--------------------
Go to the top of the page
 
Surico
post Mar 24 2017, 07:15 AM
Post#4



Posts: 47
Joined: 22-August 16



I've gone through the table and it doesn't look like any records have been deleted, what do you mean by not committed?
Go to the top of the page
 
LPurvis
post Mar 24 2017, 07:36 AM
Post#5


UtterAccess Editor
Posts: 16,086
Joined: 27-June 06
From: England (North East / South Yorks)


Not committed by example:

Open a table datasheet in your database. (For simplicity.)
Start entering field values into a new record, but then (before navigating to another row or completing the record) hit the Escape key twice.
You've just started a new record, and then abandoned it.

The same would be the case if you got a data error, due to say a Required field not being supplied, a unique index violation and so on but then closed out anyway. Closing without the record being committed (saved to disk) leaves no record created, but the autonumber value advanced.

Cheers

--------------------
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    13th December 2017 - 05:32 PM