A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Primary key numbers dissapeared



 
 
Thread Tools Display Modes
  #1  
Old July 3rd, 2009, 03:09 PM posted to microsoft.public.access
Shazza
external usenet poster
 
Posts: 104
Default Primary key numbers dissapeared

My database has juest been set up and the numbering (set to autonumber) has
jumped from record no 236 - 3665 As far as i am aware nobody has deleted
records and the database has not been tampered with. can anyone please
explain why this would happen
--
Thank you for reading my post. Hopefully you can answer my querie
  #2  
Old July 3rd, 2009, 04:05 PM posted to microsoft.public.access
Allen Browne
external usenet poster
 
Posts: 11,706
Default Primary key numbers dissapeared

Try a compact/repair.

If that doesn't work, you probably need to apply a service pack to your
version of Office and also to the JET 4 database engine. Get both from:
http://support.microsoft.com/sp

You can programmatically set the Seed of the AutoNumber. Here's some code
the will run through all your tables and check them:
http://allenbrowne.com/ser-40.html
Note that if your database is split (with attached tables), you need to run
this on the back end (the database that actually has the tables in it.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Shazza" wrote in message
...
My database has juest been set up and the numbering (set to autonumber)
has
jumped from record no 236 - 3665 As far as i am aware nobody has deleted
records and the database has not been tampered with. can anyone please
explain why this would happen
--
Thank you for reading my post. Hopefully you can answer my querie


  #3  
Old July 3rd, 2009, 04:54 PM posted to microsoft.public.access
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default Primary key numbers dissapeared

hi,

Shazza wrote:
My database has juest been set up and the numbering (set to autonumber) has
jumped from record no 236 - 3665 As far as i am aware nobody has deleted
records and the database has not been tampered with. can anyone please
explain why this would happen

An incrementing autonumber in Access/Jet is not necessarily without gaps.
The incrementing autonumber only gives you a greater number than the
last one (as a unsigned integer, but as they are always signed a flip to
negatives will happen at 2^31-1).

If you need a running number for any purposes you must generate it by
your self, e.g.

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me![runningNumber] = Nz(DMax("runningNumber", "yourTable"), 0) + 1

End Sub


mfG
-- stefan --
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:34 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.