me.newrecord and moving between form and subform

Kozbot

Registered User.
Local time
Today, 07:25
Joined
Jan 16, 2013
Messages
110
Hello

I have a both a form and a subform that display a message box informing the user they are editing an existing record.
Code:
Private Sub Form_Dirty(Cancel As Integer)
Dim response As Integer
If Not Me.NewRecord Then
response = MsgBox("You are editing and existing record!" & vbNewLine & vbNewLine & "Hit OK to continue editing or Cancel to Undo This Edit", vbOKCancel + vbDefaultButton1, "Editing Existing Record!!!")
Select Case response
Case vbOK
Case vbCancel
Cancel = True
End Select
End If
End Sub

However, this message appears when the user moves from the subform BACK to the main form. I want the message to appear when the users edits the main form or the subform ONLY when moving in from a different record on the main form. What different event or code should I use?

Thank you
 

Users who are viewing this thread

Back
Top Bottom