Problem after canceling a delete

G

Guest

This is a minor problem, but an annoying one. My form has a long list of
records in a continuous form. In the header, I have a delete button used to
delete a record identified by a combo box. When I delete a record, I get the
standard Access msg "You are about to delete 1 record(s)". If I click YES,
all works well. When I click NO, the deleted record is restored. (msg "The
RunCommand action was canceled")

Here is my problem: when the restored record is far down the list, it shows
at the top of the form window. I need to page up, page up... to show the
first records in the form. Is there code I can put after the
DoCmd.RunCommand acCmdDeleteRecord to move back to the 'top' of the form if
the Delete is canceled?

thanks
 
G

Guest

Thanks Tina, but this doesn't quite do it. When I cancel the Delete, access
immediatley leaves the Sub cmdDelete_Click(), so I can't even get to the line
DoCmd.RunCommand acCmdRecordsGoToFirst. Is there a way to trap the error
somehow if the delete is cancelled?
 
G

Guest

Sorry Tina - your answer works well. I didn't know enough to put the
DoCmd.RunCommand acCmdRecordsGoToFirst in the error trapping section. Oops.

TQ
 
T

tina

glad it worked for you. :)


Victoria said:
Sorry Tina - your answer works well. I didn't know enough to put the
DoCmd.RunCommand acCmdRecordsGoToFirst in the error trapping section. Oops.

TQ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top