Finally found something:
Code:
Option Compare Database
Option Explicit
Dim bCannotClose As Boolean
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim Response As Integer
If Me.Dirty Then Response = MsgBox("Would You Like To Save Your Changes?", vbQuestion + vbYesNoCancel + vbDefaultButton3, "Save Changes to Record?")
Select Case Response
Case vbYes
'do nothing, closing form commits record
Case vbNo
Cancel = True 'Me.Undo would work as well
Case vbCancel
Cancel = True 'Me.Undo would work as well, don't need both
bCannotClose = True
End Select
End Sub
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2169 Then
Response = acDataErrContinue
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cancel = bCannotClose
bCannotClose = False
End Sub