S
Sprinks
I have a main form Containers with a subform ContainerSubstances. The latter
has a combo box showing the substances in the Substances table. If the
desired substance is not in the combo, the user may bring up the Substances
form in Add and Dialog mode. The user can press Save or Cancel from the
latter form, and both work as designed.
If Save is pressed, the combo box on the original subform is requeried to
include the new value, and then the new value is selected by the code, and
the Substances form closes, and the user returns to the Containers form, with
focus set in the subform. All of this works.
The Containers form has its own set of Save/Cancel buttons. If its Cancel
button is pressed, any changes made on the Main form are undone, but not the
subform, including the change to the combo box.
Private Sub cmdCancel_Click()
On Error GoTo Err_Handler
If Me.Dirty = True Then
Me.sbfContainerSubstances.Form.Undo
Me.Undo
End If
DoCmd.Close acForm, Me.Name
Err_Exit:
Exit Sub
Err_Handler:
Select Case Err.Number
Case Else
MsgBox Err.Number & vbCrLf & Err.Description
Resume Err_Exit
End Select
End Sub
Does anyone have a suggestion? Do I need to copy the state of the subform
to an array temporarily, and reset it?
Thank you.
Best regards,
Sprinks
has a combo box showing the substances in the Substances table. If the
desired substance is not in the combo, the user may bring up the Substances
form in Add and Dialog mode. The user can press Save or Cancel from the
latter form, and both work as designed.
If Save is pressed, the combo box on the original subform is requeried to
include the new value, and then the new value is selected by the code, and
the Substances form closes, and the user returns to the Containers form, with
focus set in the subform. All of this works.
The Containers form has its own set of Save/Cancel buttons. If its Cancel
button is pressed, any changes made on the Main form are undone, but not the
subform, including the change to the combo box.
Private Sub cmdCancel_Click()
On Error GoTo Err_Handler
If Me.Dirty = True Then
Me.sbfContainerSubstances.Form.Undo
Me.Undo
End If
DoCmd.Close acForm, Me.Name
Err_Exit:
Exit Sub
Err_Handler:
Select Case Err.Number
Case Else
MsgBox Err.Number & vbCrLf & Err.Description
Resume Err_Exit
End Select
End Sub
Does anyone have a suggestion? Do I need to copy the state of the subform
to an array temporarily, and reset it?
Thank you.
Best regards,
Sprinks