Error removing last record from subform

J

JoeA2006

I have built a form with multiple subforms that the user can change which
subform a record appears. Using the following code for each subform,in the
afterUpdate event of the combo box ,the user can both enter a new record,
edit and existing record or change the subform the record appears in. I have
set the tab order so the combo box gets focus last in the current record. The
error occurs when I remove the last record from the subform. How do I avoid
an error in this situation.

Me.Requery
DoCmd.RunCommand acCmdRecordsGoToNew
Forms!Form1.[SubformA].Requery
Forms!Form1.[SubformB].Requery
 
B

Barry Gilbert

Joe,

The brute force way is to put On Error Resume Next in front of the two last
lines and then On Error GoTo 0 after them. However, you won't raise any other
error that arise from those commands.

Barry
 

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