I have a data entry form that is organized by an ID (AutoNumber). I have created a Save and Cancel button on the form. Once I start entering data into the form, the AutoNumber increases. If I click Save, all is well, but if I click Cancel to eras the data, the AutoNumber is still increased. In other words, if I type some data and Cancel the form, the data is discarded but the next AutoNumber in line is used. If I reopen the form, the AutoNumber is out of order because it has skipped one. Is there any way to prevent this?
Autonumbers are unique, not necessarily sequential. If you need to have sequential numbers in your application you would need to generate them on your own. If you generate them yourself you are also taking the responsibility of making them unique. Generally you just accept the fact that there are holes in the sequence and go with it.