AutoNumber

nir

New member
Local time
Today, 16:08
Joined
Oct 27, 2005
Messages
5
I have encountered the following "problem" -
When the key field is AutoNumber, the number is generated whenever I type something in thet record.
If I regret and delete all record content, the key number is "lost". The record does not appear in the table but the next record will be indexed as if it is there.

I have tried several aproaches such as use of Undo during Form.Close and then use the runCommand to perform DatabaseCompact.
I've got an error message on the compact thing.

Does any one have any idea how to regain the "lost" indexes?

Any tip will be appreciated.
 
I don't believe you can. The autonumber is intended only to create a unique key, not to number records sequentially. If you want to create a field that counts by one, add another field, for example 'RecordNumber' of data type Number and Field Size = Long Number. Then create a function that will calculate the maximum value of the field RecordNumber and add 1 to it. You can use the function on the current event of a form to set the Record Number's default or in a query.

That will give you a sequential record number.

If you need additional help, please let me know.
 
Thanks,
Actually I've done exactly this by replacing the Autonumber with just a number and then i check each time the last record and add 1 to it.
I only have some doubts what will happen when the Data base becomes too big, but for feew records of testing it works just fine.

Nir.
 

Users who are viewing this thread

Back
Top Bottom