I posted this previously and got a lot of help, but I've changed the code so much and the thread is so messy I thought it deserved a re-post for this final point:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim response As Integer
response = MsgBox("Are you sure you want to save this record?", vbOKCancel)
Exit Sub
If response = 2 Then
Cancel = True
Me.Notes.SetFocus
End If
End Sub
Clicking Cancel actually performs exactly as when you click save! It saves the record and moves to a new blank record. I should mention that the save button has a macro behind it that is "go to record, new". The theory is, the vbOKCancel should fire before the macro runs and cancel should stop the macro. Should there be some code added to the above If statement that stops the new record macro?
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim response As Integer
response = MsgBox("Are you sure you want to save this record?", vbOKCancel)
Exit Sub
If response = 2 Then
Cancel = True
Me.Notes.SetFocus
End If
End Sub
Clicking Cancel actually performs exactly as when you click save! It saves the record and moves to a new blank record. I should mention that the save button has a macro behind it that is "go to record, new". The theory is, the vbOKCancel should fire before the macro runs and cancel should stop the macro. Should there be some code added to the above If statement that stops the new record macro?