Monday, 26 August 2013

Equivalent of AfterDelConfirm event for confirming insert

Equivalent of AfterDelConfirm event for confirming insert

I'm maintaining an Access 2007 front end with tables linked to a SQL
Server 2008 R2 database. When a user deletes or inserts rows into a form
displayed as a DataSheet a dialog box will be displayed asking the user to
confirm they really want to do this (NOTE: Users can insert rows into the
DataSheet by copying other rows in the form and pasting them into the New
Record row at the bottom of the form). I know there is a
Form_AfterDelConfirm event that will pick up that the user has confirmed
they want to delete a record or records. My question is: How do I pick up
that the user has confirmed they want to insert the records they've
pasted?
I've tried to pick up the insert via the Form_AfterInsert and
Form_AfterUpdate events. However, if a user is pasting multiple rows these
events fire for each row to be inserted, before the confirm dialog is
displayed. I want to requery an aggregate query that displays totals in
another form. I find I get an error if I attempt to requery the aggregate
query before the user confirms the dialog box. I assume this is because
the insert is wrapped in a transaction or is not written to the SQL Server
database until the user confirms the dialog box. So I would like to
requery the aggregate query only after the user has confirmed they want to
insert the records.

No comments:

Post a Comment