How to undo change of field in another form

Kayleigh

Member
Local time
Today, 15:52
Joined
Sep 24, 2020
Messages
709
I have an order form which includes a combo of different order statuses. When each status is selected it triggers the relevant pop-out form to open. Each pop out form contains a save command and cancel command. My issue is with the Cancel command button - I would like the onClick event to trigger a change on the orders form - that the order status reverts back to its old value. What is the best way to program this?
 
Depends if you open the form ACDIALOG or not.
If not then on each PopUp add a variable at the top

private callingCombo as access.combobox

then after you pop up the form
the calling form needs to set the callingCombo
set forms("popupformName").callingCombo = me.cmboStatus

In the cancel event
CallingCombo.value = callingCombo.oldvalue

If you are opening ACDIALOG this will not work since you cannot set any value in the called code since execution stops in the calling form.
 
Thank you. Does the input for callingCombo need to be a combo box or can it be a text field?
 
You could do this with any control
Private returnControl as access.control
'the control to reset
set forms("popupformName").callingCombo = me.cmboStatus

In the cancel event
returnControl.value = returnControl.oldvalue
 
you can also try to use the OldValue directly:

Forms!FormNotThePopUp!combo = Forms!FormNotThePopUp.OldValue
 

Users who are viewing this thread

Back
Top Bottom