L
Lorraine
When the value in textbox TypeID is updated I want there to be a Warning
through a message box. If the user clicks the "No" button I want there to be
an automatic "undo" of the change.
The message box displays and the Yes button functions, but when the No
button is selected I get a run-time error '2115' that states "The macro or
function set to the BeforeUpdate or ValidationRule property for this field is
preventing Microsoft Access from saving the data in the field." I don't have
a ValidationRule property set for this field.
Private Sub TypeID_BeforeUpdate(Cancel As Integer)
OriginalValue = TypeID.OldValue
RetValue = MsgBox("You are about to CHANGE or DELETE a TypeID. Are you sure
you want to do this?", 260 + vbCritical, "WARNING")
If RetValue = vbNo Then
For Each ctlTextbox In Me.Controls
If TypeID.ControlType = acTextBox Then
TypeID.Value = TypeID.OldValue
End If
Next ctlTextbox
End If
End Sub
In the nested If-Then statement, the TypeID.Value is capturing the updated
value and the TypeID.OldValue is capturing the value before update but this
is the line of code that is also being highlighted by the debugger.
Help me please.
through a message box. If the user clicks the "No" button I want there to be
an automatic "undo" of the change.
The message box displays and the Yes button functions, but when the No
button is selected I get a run-time error '2115' that states "The macro or
function set to the BeforeUpdate or ValidationRule property for this field is
preventing Microsoft Access from saving the data in the field." I don't have
a ValidationRule property set for this field.
Private Sub TypeID_BeforeUpdate(Cancel As Integer)
OriginalValue = TypeID.OldValue
RetValue = MsgBox("You are about to CHANGE or DELETE a TypeID. Are you sure
you want to do this?", 260 + vbCritical, "WARNING")
If RetValue = vbNo Then
For Each ctlTextbox In Me.Controls
If TypeID.ControlType = acTextBox Then
TypeID.Value = TypeID.OldValue
End If
Next ctlTextbox
End If
End Sub
In the nested If-Then statement, the TypeID.Value is capturing the updated
value and the TypeID.OldValue is capturing the value before update but this
is the line of code that is also being highlighted by the debugger.
Help me please.