troubleshooting Question

Set Combo Box to Previous Value

Avatar of mlcktmguy
mlcktmguyFlag for United States of America asked on
Microsoft Access
2 Comments1 Solution211 ViewsLast Modified:
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.
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros