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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|