resetting an Autonumber field in a Table.

sts023

Registered User.
Local time
Today, 20:52
Joined
Dec 1, 2010
Messages
40
I have a module which adds records to a Table.
The Primary Key for the Table is defined as Autonumber.
As I'm in the testing phase, I've some code which deletes each record in the Table, to clear it down prior to my next effort.
However, the Autonumber field (as you would expect) just keeps trundling on.

My question (which is not vital), is

"Is there any way from the VB script that I can reset this Autonumber field either to a base value, or to a specific value before re-populating the Table?" (I suspect I may have to delete the field, then add a new one).

What I want to achieve is that each time I run a "Table reload" test I get the same values in the field.

Thanks in advance for anybody's help....
 
1. Yes, you can clear the table and then do a COMPACT AND REPAIR of the database and it will reset.

2. You really shouldn't care whether they are reset or not because autonumbers shouldn't really be used for anything other than generating a unique number for a surrogate key.

3. I have a database reset tool which can clear your tables (and bypass any you select to be bypassed) and reset the autonumbers. It is free and available in the Access Tools section of my website (see my signature).
 
Sorry guys, I just found out about "Compact and Repair" - please ignore this thread.
 
Bob - I'm really impressed by your site.
The Database Reset utility works like a dream.
I'm just not sure that coding so powerful should be freely available to inquisitive little erks like me. :D

Now, I've just got to figure out a way to disable the "Run Sub/UserForm" function (for my own safety)....
 

Users who are viewing this thread

Back
Top Bottom