G
Gordon
I have a form (frmVocalArrangments) with a button that when pressed
opens another form (frmDiscs) in data add mode - but keeps
frmVocalArrangments open.
On frmDiscs, when the new record is added, I have a "Return" button
that takes me back to frmVocalArrangments with the code:
Private Sub cmdReturn_Click()
On Error GoTo cmdReturn_Click
If Me.OpenArgs = "frmVocalArrangements" Then
DoCmd.OpenForm "frmVocalArrangements"
CloseForm Me [Note: closeform is a standard module I have to close
the current form]
Exit Sub
Else
DoCmd.OpenForm "frmFormsMenu"
CloseForm Me
End If
Exit_cmdReturn_Click:
Exit Sub
cmdReturn_Click:
MsgBox Error$
Resume Exit_cmdReturn_Click
End Sub
So far so good. frmDiscs closes and I am returned to
frmVocalArrangements
However, on frmDiscs I also have a "Cancel" button to undo any changes
with the code:
Private Sub cmdCancel_Click()
On Error GoTo cmdCancel_Err
SendKeys "{Esc}", True
Me.Undo
DoCmd.ShowAllRecords
cmdCancel_Exit:
Exit Sub
cmdCancel_Err:
MsgBox Error$
Resume cmdCancel_Exit
End Sub
If I use this button and then press the Return button, I am returned
to thewrong form (frmFormsMenu) - with frmVocalArrangements still open
in the background.
I have tried all combinations of code on these two buttons but just
cannot get them both to work the way I want.
Where am I going wrong?
Gordon
opens another form (frmDiscs) in data add mode - but keeps
frmVocalArrangments open.
On frmDiscs, when the new record is added, I have a "Return" button
that takes me back to frmVocalArrangments with the code:
Private Sub cmdReturn_Click()
On Error GoTo cmdReturn_Click
If Me.OpenArgs = "frmVocalArrangements" Then
DoCmd.OpenForm "frmVocalArrangements"
CloseForm Me [Note: closeform is a standard module I have to close
the current form]
Exit Sub
Else
DoCmd.OpenForm "frmFormsMenu"
CloseForm Me
End If
Exit_cmdReturn_Click:
Exit Sub
cmdReturn_Click:
MsgBox Error$
Resume Exit_cmdReturn_Click
End Sub
So far so good. frmDiscs closes and I am returned to
frmVocalArrangements
However, on frmDiscs I also have a "Cancel" button to undo any changes
with the code:
Private Sub cmdCancel_Click()
On Error GoTo cmdCancel_Err
SendKeys "{Esc}", True
Me.Undo
DoCmd.ShowAllRecords
cmdCancel_Exit:
Exit Sub
cmdCancel_Err:
MsgBox Error$
Resume cmdCancel_Exit
End Sub
If I use this button and then press the Return button, I am returned
to thewrong form (frmFormsMenu) - with frmVocalArrangements still open
in the background.
I have tried all combinations of code on these two buttons but just
cannot get them both to work the way I want.
Where am I going wrong?
Gordon