J
Jason
Hi there
I am using the following code in the before update event. the purpose of
this, is to allow any accidental changes to values in a field, to be undone.
However... I have a couple of issues, that I am hoping someone might be able
to offer advice on.
1) Is it possible for this code to only be applied if the record is a saved
record. Meaning that, if a user is adding a new record. the message will not
display, or if the field being updated is blank (No current values).
2) I noticed that deleting a value in a field is not considered a change. I
tested the code, and when I add a character to the field, the message
displays, but if I delete the values in the field, then the message does not
display
Here is the code:
Private Sub TXT_PROPERTY_BeforeUpdate(Cancel As Integer)
'==========================================================================
' This gives the user the opportunity to undo changes, where changes are
' not valid
'==========================================================================
msg = "Changes have been detected in this field " & vbCr
& vbCr
msg = msg & "Would you like to save these changes?"
If Not IsNull(Me.TXT_PROPERTY) Then
If MsgBox(msg, vbQuestion + vbYesNo, "Removed Company Name") = vbNo Then
Me.Undo
End If
End If
End Sub
I am using the following code in the before update event. the purpose of
this, is to allow any accidental changes to values in a field, to be undone.
However... I have a couple of issues, that I am hoping someone might be able
to offer advice on.
1) Is it possible for this code to only be applied if the record is a saved
record. Meaning that, if a user is adding a new record. the message will not
display, or if the field being updated is blank (No current values).
2) I noticed that deleting a value in a field is not considered a change. I
tested the code, and when I add a character to the field, the message
displays, but if I delete the values in the field, then the message does not
display
Here is the code:
Private Sub TXT_PROPERTY_BeforeUpdate(Cancel As Integer)
'==========================================================================
' This gives the user the opportunity to undo changes, where changes are
' not valid
'==========================================================================
msg = "Changes have been detected in this field " & vbCr
& vbCr
msg = msg & "Would you like to save these changes?"
If Not IsNull(Me.TXT_PROPERTY) Then
If MsgBox(msg, vbQuestion + vbYesNo, "Removed Company Name") = vbNo Then
Me.Undo
End If
End If
End Sub