Microsoft
Software
Hardware
Network
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_Approv
al = "Yes" Then
Me.txt_Signature.Visible = True
Me.Signature_Date = date()
Else
If Me.Approval.Column(1) = "Approved" And Forms!frm_Login!txt_Approv
al = "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
Can I convert a SQL Server 64 bit database to 32 bit
Need to convert a macro to VB code in Access and then insert additional code for Log In Screen
Disable Win XP auto-created printer from being auto-created by Citrix
Can I read an MS Access table from SQL Stored Procedure?
roaming profile files keep appearing after deleted
What is the best way to upgrade AD/Exchange Server
Export to excel in ssrs 2008
How can an event caller be identified
WSUS 3.0 sp2 server 2003 x86 to 2008 R2 x64
Edit filename variable in Batch script