A
Andy Levy
Hi
I have a combobox called "Status" on my form. There are six string-type
values in the list.
I have a piece of code that should validate the change of status - in the
combo's beforeUpdate event. But it throws up an error when trying to change
the value back afterwards.
Here is the code ...........
Private Sub status_BeforeUpdate(Cancel As Integer)
'Living
If Me.status.OldValue = "Sold" And Not Me.status = "Sold" Then
Dim answer
answer = MsgBox("Changing the status from SOLD will remove Sold
Price and Weight data." & vbCrLf & vbCrLf & "Click OK to proceed",
vbOKCancel, "Change of Status")
If answer = 2 Then 'vbCancel
Cancel = True
Me.status = Me.status.OldValue
End If
End If
Exit Sub
The error i receive is
Runtime Error : code is given
The macro or function set to the beforeUpdate property for this field is
preventing myDatabase from saving the data in this field
Hope you can help
Thanks
Andy
I have a combobox called "Status" on my form. There are six string-type
values in the list.
I have a piece of code that should validate the change of status - in the
combo's beforeUpdate event. But it throws up an error when trying to change
the value back afterwards.
Here is the code ...........
Private Sub status_BeforeUpdate(Cancel As Integer)
'Living
If Me.status.OldValue = "Sold" And Not Me.status = "Sold" Then
Dim answer
answer = MsgBox("Changing the status from SOLD will remove Sold
Price and Weight data." & vbCrLf & vbCrLf & "Click OK to proceed",
vbOKCancel, "Change of Status")
If answer = 2 Then 'vbCancel
Cancel = True
Me.status = Me.status.OldValue
End If
End If
Exit Sub
The error i receive is
Runtime Error : code is given
The macro or function set to the beforeUpdate property for this field is
preventing myDatabase from saving the data in this field
Hope you can help
Thanks
Andy