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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Re-number an Autonumber



 
 
Thread Tools Display Modes
  #1  
Old October 12th, 2009, 06:40 PM posted to microsoft.public.access.tablesdbdesign
ADonMS
external usenet poster
 
Posts: 19
Default Re-number an Autonumber

Is it possible to re-number an Autonumber that is the primary key on a table?
For some reason my autonumber is skipping in sequential order and when I
create query, I'm missing a row that is listed on the table.
  #2  
Old October 12th, 2009, 06:50 PM posted to microsoft.public.access.tablesdbdesign
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default Re-number an Autonumber

hi,

ADonMS wrote:
Is it possible to re-number an Autonumber that is the primary key on a table?
For some reason my autonumber is skipping in sequential order and when I
create query, I'm missing a row that is listed on the table.

Basically, yes. But the normal autonumber data type is only guaranteed
to increase, not to be without gap. If you need an increasing sequence
without gaps then you need to create it by yourself, e.g. in a forms
before update event:

Public Sub Form_BeforeUpdate(Cancel as Integer)

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

End Sub


mfG
-- stefan --
  #3  
Old October 12th, 2009, 07:07 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Re-number an Autonumber

If you are talking about an Access Autonumber field, no. Access
automatically generates that value, and you have no control over it.

But the purpose of an Access Autonumber is to provide a unique row
identifier. It isn't guaranteed to be sequential, and is generally unfit
for human consumption.

It sounds like you are looking at the "1 of n" navigation information at the
bottom of a table display and expecting those values to match your
autonumber field. AIN'T GONNA HAPPEN! Those navigation numbers change
every time you re-sort the table. The Autonumbers are set and never change.

If this doesn't resolve your issue, please provide more detailed
description...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"ADonMS" wrote in message
...
Is it possible to re-number an Autonumber that is the primary key on a
table?
For some reason my autonumber is skipping in sequential order and when I
create query, I'm missing a row that is listed on the table.



  #4  
Old October 12th, 2009, 07:59 PM posted to microsoft.public.access.tablesdbdesign
ADonMS
external usenet poster
 
Posts: 19
Default Re-number an Autonumber

Thanks, for input.


"Stefan Hoffmann" wrote:

hi,

ADonMS wrote:
Is it possible to re-number an Autonumber that is the primary key on a table?
For some reason my autonumber is skipping in sequential order and when I
create query, I'm missing a row that is listed on the table.

Basically, yes. But the normal autonumber data type is only guaranteed
to increase, not to be without gap. If you need an increasing sequence
without gaps then you need to create it by yourself, e.g. in a forms
before update event:

Public Sub Form_BeforeUpdate(Cancel as Integer)

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

End Sub


mfG
-- stefan --

  #5  
Old October 12th, 2009, 08:10 PM posted to microsoft.public.access.tablesdbdesign
ADonMS
external usenet poster
 
Posts: 19
Default Re-number an Autonumber

Thanks, Jeff. That's what I was doing. So, I no longer need to think about
the sequential ordering in this case.
Much appreciated info.

"Jeff Boyce" wrote:

If you are talking about an Access Autonumber field, no. Access
automatically generates that value, and you have no control over it.

But the purpose of an Access Autonumber is to provide a unique row
identifier. It isn't guaranteed to be sequential, and is generally unfit
for human consumption.

It sounds like you are looking at the "1 of n" navigation information at the
bottom of a table display and expecting those values to match your
autonumber field. AIN'T GONNA HAPPEN! Those navigation numbers change
every time you re-sort the table. The Autonumbers are set and never change.

If this doesn't resolve your issue, please provide more detailed
description...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or psuedocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"ADonMS" wrote in message
...
Is it possible to re-number an Autonumber that is the primary key on a
table?
For some reason my autonumber is skipping in sequential order and when I
create query, I'm missing a row that is listed on the table.




 




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 12:21 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.