Error removing last record from subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Back
Top