Hey there all, I have a problem and hope there's an easy solution.
My main table has an autonumber primary index (MainID). I've been using this field to sort my reports because I want them to display in the order that they were entered. However, occasionally I want to insert a record in this table instead of adding it to the end. I already figured I can't mess around with the autonumber so I thought of creating a (SortOrder) field and populating with chronologic numbers. Then every time I add a record, I would assign (SortOrder+1) to the new record. This would work sort of like an autonumber right? Okay, so now if I want to insert a record between say record 9 and 10 of 15 records, I would need to write some code that would change the SortOrder numbers of records 10-15 to 11-16, thus freeing up number 10 to add my new record. Can anyone help me with the code to do this? Or is there and easier way? Thanks!
My main table has an autonumber primary index (MainID). I've been using this field to sort my reports because I want them to display in the order that they were entered. However, occasionally I want to insert a record in this table instead of adding it to the end. I already figured I can't mess around with the autonumber so I thought of creating a (SortOrder) field and populating with chronologic numbers. Then every time I add a record, I would assign (SortOrder+1) to the new record. This would work sort of like an autonumber right? Okay, so now if I want to insert a record between say record 9 and 10 of 15 records, I would need to write some code that would change the SortOrder numbers of records 10-15 to 11-16, thus freeing up number 10 to add my new record. Can anyone help me with the code to do this? Or is there and easier way? Thanks!