Skip series of autonumbers ?

D

David

I have a VBA routine that adds records to a table. This table has an autonumber key

There are a series of numbers that are reserved and I need to skip allocationg those autonumbers. How is this done?

Essentially I need to run my routine until I come to the first reserved autonumber, then start off again after the last reserved autonumber.
 
V

Van T. Dinh

AutoNumbers are not meant to work this way. In fact, the main purpose of an
AutoNumber Field is to provide uniqueness to each Record in the Table. The
actual numbers / values allocated should NOT matter. In fact, AutoNumber
Field values can become random or even negative.

In you case, it is NOT possible to reserve a block of numbers but even if it
were possible, once a value higher than the reserved range is used by
Access, you cannot use / assign the numbers in the reserved range, anyway.
Hence, there is no point in reserving the range.

Suggest you read Access Help / book on AutoNumber Field and you will need to
either use a different strategy or a different Field type.

--
HTH
Van T. Dinh
MVP (Access)



David said:
I have a VBA routine that adds records to a table. This table has an autonumber key.

There are a series of numbers that are reserved and I need to skip
allocationg those autonumbers. How is this done?
Essentially I need to run my routine until I come to the first reserved
autonumber, then start off again after the last reserved autonumber.
 
D

David

I dont think you understand my problem. When I say 'reserve numbers', I mean I will create blank records in the table for those numbers. The exisitng numbers must be used for the new table. Unfortunatelty, its a management requirement.

So my question is really how do I reset the number where autonumbering begins?
 
V

Van T. Dinh

If you are about the values of the Field, don't use AutoNumber type.

Search Google for threads on AutoNumber to heaps of problems if AutoNumbers
are used not as intended by Access.

Search also for "Custom Number Sequence" for possible solution.

--
HTH
Van T. Dinh
MVP (Access)



David said:
I dont think you understand my problem. When I say 'reserve numbers', I
mean I will create blank records in the table for those numbers. The
exisitng numbers must be used for the new table. Unfortunatelty, its a
management requirement.
So my question is really how do I reset the number where autonumbering
begins?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top