Question : How to get back original value of a combo box

Help!  I am stuck... I am using MS Access 2003

In a form, I have an APPROVAL field that is a combo box created from tbl_Status (SELECT DISTINCT tbl_Status.ApprovalID, tbl_Status.Approval FROM tbl_Status ORDER BY tbl_Status.Approval; ) with properties (column count =2 and Bound Column =1) --
tbl_status
ApprovalID      Approval
1                      Empty
3                      Pending
4                      Rejected
6                     Approved
7                     Applied

Here is the problem, there are only 2 users (Mr. A and Mr. B) can change the statuses of APPROVAL field to anything, and only those 2 users can change any statuses to "Approved" -- Besides those 2 users, anyone can change other statuses besides "Approved" -- If Other users will change the status to "Approved" -- For example, the original Approval status was "Pending", a user wanted to change, from "Pending" to "Approved" and a user can't change the "Approved" status to any other statuses -- Once it "Approved" - it set and only Mr A or Mr. B can change the "Approved" status to other statuses -- There will be a message prompted "Sorry! You do not have the PERMISSION to change the status to APPROVED or APPROVED to any other statuses -- Please contact either Mr. A or Mr. B" and the Approval value must roll back to its original "Pending" value instead stayed as "Approved"

I did create 2 Text Boxes: txt_Approval_ID and txt_Approval to store it's original values when the form opened -- here is my simple codes

Private Sub Approval_AfterUpdate()

Dim ctlCombo As Control

' Return Control object pointing to a combo box.
Set ctlCombo = Me!Approval

If Me.Approval.Column(1) = "Approved" And Forms!frm_Login!txt_Approval = "Yes" Then
    Me.txt_Signature.Visible = True  
    Me.Signature_Date = date()

Else
    If Me.Approval.Column(1) = "Approved" And Forms!frm_Login!txt_Approval = "No" Then  
        MsgBox "Sorry! You do not have the PERMISSION to change the status to APPROVED -- Please contact either Mr. A or Mr. B"
        Me!Approval.Column(0) = Me!txt_Approval_ID
        Me!Approval.Column(1) = Me!txt_Approval
        ' Requery source of data for list box.
        ctlCombo.Requery
    Else
   
    End If

End If
End Sub

What should I do to make the Approval combo box to be able to roll back its other original statuses besides "Approved"?

Thanks much

Answer : How to get back original value of a combo box

OldValue is available in VBA.

from VBA window, Help type OldValue
and you will see an example
Random Solutions  
 
programming4us programming4us