| | |
|
|
|
ID Number Question |
| message from Gordon on 16 May 2004 |
VB.Net Standard, Win2k Pro, MS Access 2000 w/all patchs up to date.
I have a tmp table that is emptied after application execution. It has an
autonumber ID primary key. How do I get the ID key to reset to 0 after each
use?
Thanks
GG
|
| Gordon replied to Gordon on 17 May 2004 |
I would like to thank everyone that replied. The question was more curiosity
than requirement. Thanks again.
Gordon
"Gordon" <out_of_office_reply@outofoffice.net> wrote in message
news:40a78858$0$8404$a0ced6e1@news.skynet.be...
|
| Larry Daugherty replied to Gordon on 16 May 2004 |
Hi Gordon,
After you've deleted all the records, compact and repair the database.
As a general rule, human beings should never see an autonumber value nor
should a developer care what its value happens to be. It exists to provide
uniqueness when used as a Primary Key. Use for any other purpose will
almost always lead to problems.
HTH
|
| Tony Toews replied to Gordon on 16 May 2004 |
This can also add to significant bloating. Also how do you keep one
users records separate from another users?
See the TempTables.MDB page at my website which illustrates how to use
a temporary MDB in your app.
http://www.granite.ab.ca/access/temptables.htm Should be close
enough to VB.Net to be usable. Hmmm, maybe not.
Tony
|
| Douglas J. Steele replied to Gordon on 16 May 2004 |
Compact the database.
Of course, it shouldn't matter. The only point of an Autonumber field is to
provide a (practically guaranteed) unique value that can be used as a
primary key. 436, 437, 438 serves that purpose just as well as 1, 2, 3.
Seldom, if ever, should you even be aware of the value of the Autonumber
field.
|
| Cheryl Fischer replied to Gordon on 16 May 2004 |
Gordon,
In addition to the very good advice from Doug and Larry, it occurs to me
that you may be using this tmp table (requiring an AutoNumber beginning with
1) as a way to provide row or record numbers for use by your users. If so,
you might want to check out MVP Stephen Lebans' techniques for doing this
at:
http://www.lebans.com/rownumber.htm
|
|
Archived message: ID Number Question (MS Access Database)