I have an Access database (attached) with a form (Form1) containing a combobox and a subform.
The row source of the combobox is a table containing a list of state abbreviations.
The record source of the subform is a query that retrieves records from a table (Table1).
The table contains monetary data related to states.
In that table, multiple records pertaining to a particular state may appear.
Just for illustration, I loaded the table with records from a handful of states (AL, CA, NY,TX).
When you open the form, select NY from the combobox and you will see the subform is populated with “NY” records.
Once you do that, then select a different state from the combobox. You will see a messagebox appear.
Select cancel. You’ll note that ‘NY’ records still appear in the subform (as they should) but the combobox now displays the different value you selected.
What I’m trying to accomplish:
When Cancel is selected from the messagebox (which SHOULD be serving the purpose of canceling a change to the record(s) displayed in the subform), I want the combobox to revert back to the value before the change (I want it to match the state value in the subform). In this case it would be NY. What’s happening now is that the cancel command is properly canceling a change to the subform data. However, the combobox value still changes, so I’m winding up with NY records displayed in the subform yet the combobox displays a different value (whatever different state I may have selected).
When I select Cancel from the messagebox (which cancels a change to the records displayed in the subform), I want the combobox to display the same state as displayed in the subform.