Run-time error 2115

  • Thread starter Thread starter Little Penny
  • Start date Start date
L

Little Penny

I have a form called computers that sets on top of a query of the Computers and UserInfo tables. The Users table has a one to many relationship with
the computers table which is joined by the UserID field. The form works great but I wanted to put a before update event to confirm when changes are me
I use the VB code

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Not Me.NewRecord Then
If MsgBox("Changes have been made to this record" _
& vbCrLf & "Do you want to save these changes?" _
, vbYesNo + vbDefaultButton2, "Changes Made...") = vbYes Then
DoCmd.RunCommand acCmdSaveRecord

End If
End If
End Sub

When I click No it works fine all changes go back to there original value but when I click yes I get "Run-time error 2115

Thanks
 
Lose the line:
DoCmd.RunCommand acCmdSaveRecord

The record is about to be saved (that's why this event fired), so you don't
explicitly save in this event.
 
Thanks for your reply. This got rid of the runtime error but if I make changes and advance to the next record. It not only saves changes to the
current record but also changes the next record as well.
 
Back
Top