mlcktmguy
asked on
Set Combo Box to Previous Value
I want to keep my users from assigning a particular status if a load has any detail associated with it. The code in the code window show my current routine. It certainly gives an error when the user tries to do it. However, it doesn't set the value of the combo box back to what it was originally. Seems to me there is a nice quick way of doing this.
I realize that I could save the value to a variable on entry into the combo box and restore the value back wheneve I encounter the error but I thought there was an easier/built in way to pull the original value.
I realize that I could save the value to a variable on entry into the combo box and restore the value back wheneve I encounter the error but I thought there was an easier/built in way to pull the original value.
Private Sub StatusID_BeforeUpdate(Cancel As Integer)
'
' if there is cost detail it cannot be cancelled
'
If Nz(Me.StatusID, 0) = eLoadStatus.Cancelled Then
If AnyMatchesInOtherTable("tblShipmentItem_Numeric", _
"ShipmentID", _
Nz(Me.ID, 0)) Then
MsgBox "This load canot be cancelled because there is cost detail associated with it."
Exit Sub
End If
End If
'
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER