T
Tony_VBACoder
In Access 2000, I have form that is bound to a table whose Primary Key field
is an AutoNumber datatype. On my form, when the user is creating a NEW
record, I have a "Cancel" button whose click event runs the following VBA
code:
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
My problem is, if the user starts entering data into some of the fields, and
then clicks the "Cancel" button, the Undo code prevents the insertion of this
record, but the AutoNumber has still be incremented, which leaves gaps in the
primary keys in my table. Is there anyway that I can get the AutoNumber to
not increment in value when the Undo occurs? I am looking for VBA code to do
this.
is an AutoNumber datatype. On my form, when the user is creating a NEW
record, I have a "Cancel" button whose click event runs the following VBA
code:
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
My problem is, if the user starts entering data into some of the fields, and
then clicks the "Cancel" button, the Undo code prevents the insertion of this
record, but the AutoNumber has still be incremented, which leaves gaps in the
primary keys in my table. Is there anyway that I can get the AutoNumber to
not increment in value when the Undo occurs? I am looking for VBA code to do
this.