Form ‘For Booking Out’ uses order details that need to be inserted into three separate tables for a new Cask.
A Cask ID is entered then ‘Update Own Cask Tables’ puts fields into the appropriate tables, eg Casks Racked/Sold needs Date Sold and Order Detail ID from the first form.
If wanting to undo the changes immediately, clicking ‘Undo All Changes’ displays the changes properly. But closing this form and clicking ‘Show Update Results’ shows the changes have been ignored; ie the table fields still have the updates.
If instead I close the second form after it’s received the updates, then click ‘Show Update Results’ in the first form the results are correct, with the updates undone.
The second form has Save instructions as below but they're not covering both methods.
A Cask ID is entered then ‘Update Own Cask Tables’ puts fields into the appropriate tables, eg Casks Racked/Sold needs Date Sold and Order Detail ID from the first form.
If wanting to undo the changes immediately, clicking ‘Undo All Changes’ displays the changes properly. But closing this form and clicking ‘Show Update Results’ shows the changes have been ignored; ie the table fields still have the updates.
If instead I close the second form after it’s received the updates, then click ‘Show Update Results’ in the first form the results are correct, with the updates undone.
The second form has Save instructions as below but they're not covering both methods.
Code:
Private Sub cmdReverseChanges_Click()
If Me.Dirty = True Then
Me.Dirty = False
End If
If MsgBox("Are you sure you want to undo the updates?", vbYesNo) = vbNo Then
Exit Sub
End If
DoCmd.SetWarnings False
'Update queries for the three tables
DoCmd.OpenQuery "qryResetCaskPopulation"
DoCmd.OpenQuery "qryResetCasksRackedSold"
DoCmd.OpenQuery "qryResetOrderDetails"
DoCmd.SetWarnings True
'Ensure updates are displayed in subforms
Me.sfmUpdatedCaskRackedSold.Form.Requery
Me.sfmUpdatedCaskPopulation.Form.Requery
Me.sfmUpdatedOrderDetails.Form.Requery
DoCmd.Save
'Ensure changes are reflected in first form
Forms!frmBookOut.Requery
End Sub