How to undo change of field in another form (1 Viewer)

Kayleigh

Member
Local time
Today, 14:12
Joined
Sep 24, 2020
Messages
706
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?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:12
Joined
Jul 9, 2003
Messages
16,245
This might help:-


If not, please post a cut down version of your database with any confidential information removed. All that is required is the main form and the Pop-Up forms and any associated tables. Don't need the rest of your database.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 10:12
Joined
May 21, 2018
Messages
8,463
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.
 

Kayleigh

Member
Local time
Today, 14:12
Joined
Sep 24, 2020
Messages
706
Thank you. Does the input for callingCombo need to be a combo box or can it be a text field?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 10:12
Joined
May 21, 2018
Messages
8,463
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:12
Joined
May 7, 2009
Messages
19,175
you can also try to use the OldValue directly:

Forms!FormNotThePopUp!combo = Forms!FormNotThePopUp.OldValue
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:12
Joined
Feb 19, 2002
Messages
42,983
Seems like a convoluted process. Why open a second form when you actually want to update the original?
 

Users who are viewing this thread

Top Bottom