PDA

View Full Version : auto increment fields - where is high # stored?


ABC123

Al Bronson
06-22-2000, 03:21 PM
I've had some occasions where it would be awfully nice to edit the current "highest count" of an auto incrementing field.

In case anyone hasn't discovered it yet, if you have some sort of existing field with a numeric count stored in it, and you turn on the auto increment option (late in the game) it starts incrementing each new record from 1, and ignores the existing content of the field in all of the existing records. I would love to go in and do a one time edit of whatever file that counter lives in, to set it to start at say 163, if the db currently has 162 valid records in it!

Similarly, I have a simple set in which the link is based upon the content of an incremented field, and recently noticed that the counter must have gotten reset, and I now have two records where the incremented field has a 1 in it! The very first record entered in this db, and now the very latest both have 1s.

TIA!

csda1
06-22-2000, 09:01 PM
Al,

The last number to autoincrement is always the value from the last record in record number order. The exception is if you have two or more people in enter mode at the same time. At Save Time, if the number has already been saved by another user, you will hear a beep, and get a number that is larger than that already saved.

Regards,

Ira J. Perlow
Computer Systems Design & Associates
csda@mediaone.net

Robert Picard
06-22-2000, 10:24 PM
Hi Al

You might think about appending the offending record to a temporary table with no field rules change the value and then reappend to you original table.

Keep In mind as Ira says that if you append to your original table and the Increment field value is less than the previous values it will start counting from the lower value.

i.e.
you have 20 records with the increment value in record twenty being 20 as well. You append the modified record with an increment value of 15. A new record will have an increment value of 16 not 21 or 22.

If you want it to be sequential you will need to do multiple appends so that your record numbers and increment numbers will be sequential.

Hope this helps
Robert