Cancel new record?
I have function that find the last record, looks at the primary key field value and adds 1 to the number. My records get this sequence 1001, 1002, 1003, 1004......... and so on. The user must clicks a button to add a new record. The user is then prompted with a question if he or she wants to add a new record.
Now if the user clicks 'No', then I'd like the user to bee at the same record as when the 'Add Record' button was clicked.
The problem now is that the record gets canceled (using the BeforeInsert event) but there's now a 'new' record containing default values. Now for instance the record navigation bar displays 'record 7 of 7'. If I now click on the 'previous button' on the navigation bar - it now displays 'record 6 of 6'. I would like to be at this place automatically after pressing 'No' to add records.
I've tried using DoCmd.GoToRecord commands without any luck.
Any suggestions?
Thanks in advance
I have function that find the last record, looks at the primary key field value and adds 1 to the number. My records get this sequence 1001, 1002, 1003, 1004......... and so on. The user must clicks a button to add a new record. The user is then prompted with a question if he or she wants to add a new record.
Now if the user clicks 'No', then I'd like the user to bee at the same record as when the 'Add Record' button was clicked.
The problem now is that the record gets canceled (using the BeforeInsert event) but there's now a 'new' record containing default values. Now for instance the record navigation bar displays 'record 7 of 7'. If I now click on the 'previous button' on the navigation bar - it now displays 'record 6 of 6'. I would like to be at this place automatically after pressing 'No' to add records.
I've tried using DoCmd.GoToRecord commands without any luck.
Any suggestions?
Thanks in advance
Last edited: