J
jennie
Guest
I wrote this code (below)on before update event in all my forms to avoid mistakes by accident. It worked fine but when I select Yes or No access taking me to the next record.
How can I stay in my current record????
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Form_BeforeUpdate_error
Dim intResponse As Integer
Dim strMSG As String
strMSG = "Data on the form has changed. Do you want to save changes?"
intResponse = MsgBox(strMSG, vbQuestion + vbYesNo, "Confirm Action")
Select Case intResponse
Case vbNo
DoCmd.RunCommand acCmdUndo
End Select
Form_BeforeUpdate_exit:
Exit Sub
Form_BeforeUpdate_error:
MsgBox Err & vbCr & Err.Description, vbExclamation, "Form_BeforeUpdate"
Resume Form_BeforeUpdate_exit
End Sub
How can I stay in my current record????
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Form_BeforeUpdate_error
Dim intResponse As Integer
Dim strMSG As String
strMSG = "Data on the form has changed. Do you want to save changes?"
intResponse = MsgBox(strMSG, vbQuestion + vbYesNo, "Confirm Action")
Select Case intResponse
Case vbNo
DoCmd.RunCommand acCmdUndo
End Select
Form_BeforeUpdate_exit:
Exit Sub
Form_BeforeUpdate_error:
MsgBox Err & vbCr & Err.Description, vbExclamation, "Form_BeforeUpdate"
Resume Form_BeforeUpdate_exit
End Sub