When a user goes into a text box, I copy the value to a hidden text box. Once the text box is changed and the user leaves the record (not just the field but up or down to a new record), on the OnExit event, I check to see if the data has changed. If it has, I prompt to user to see if this is what they want, If they choose Yes, everything works, but if they choose NO, then it doesn't work.
I get the following error: Run-time error '-2147352567 (80020009)'; the data has been changed.
I noticed that the BeforeUpdate event gets called before the ON_Exit event. In the BeforeUpdate event, I modify the UserID and ModifiedTime, but I don't touch the two text box fields.
Here is the code I have in my OnExit event:
Thanks
I get the following error: Run-time error '-2147352567 (80020009)'; the data has been changed.
I noticed that the BeforeUpdate event gets called before the ON_Exit event. In the BeforeUpdate event, I modify the UserID and ModifiedTime, but I don't touch the two text box fields.
Here is the code I have in my OnExit event:
Code:
Private Sub txtFromLegalName_Exit(Cancel As Integer)
Dim strMessage As String
Dim intResponse As Integer
If Me.CurrentRecord = 2 Then
strMessage = "Are you sure you want to modify the original record?"
If Forms![Pipeline Assignment]![txtHiddenFieldValue] <> Me.txtFromLegalName Then
intResponse = MsgBox(strMessage, vbOKCancel)
If intResponse <> 1 Then
'Cancel = True
Me.txtFromLegalName.SetFocus
Me.txtFromLegalName = Forms![Pipeline Assignment]![txtHiddenFieldValue]
End If
End If
End If
End Sub