Run-time error 2115

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
 
A

Allen Browne

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.
 
L

Little Penny

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.
 

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