I have the procedure as shown here below. When the response is Yes, it generated the Error 2115(The macro or function set to the BeforUpdate or ValidationRule property for this field is preventing Microsoft Access from saving the data in the field.)
Even though the error says "
preventing Access from saving
" the changes were still saved, however. I have also tried the "DoCmd.RunCommand acCmdSaveRecord", it still produced the same error message. What or where trigger the error??
Thanks
Phucon
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo ErrorHandler
If Me.Dirty = True Then
If MsgBox("You have made changes to the data. Save changes?", vbYesNo, "Information") = vbYes Then
Me.Dirty = False 'force the record to be saved explicitly.
'DoCmd.RunCommand acCmdSaveRecord
Else
Me.Undo
End If
End If
ExitProcedure:
Exit Sub
ErrorHandler:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_BeforeUpdate"
Resume ExitProcedure
End Sub
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (1) |
Tidak ada komentar:
Posting Komentar