I'm trying to add code to a cmd button so that it will close the active form and a second form, then return the user to the main menu. However, I'm having trouble with the argument to close the 2nd form and need help with the syntax. Here's what I have:
Active form = frmReports
Second form = frmRptCritera
Active form = frmReports
Second form = frmRptCritera
Code:
Private Sub cmdRtnToMainMenu_Click()
On Error GoTo Err_cmdRtnToMainMenu_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmRptCriteria"
DoCmd.Close stDocName, , , stLinkCriteria
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Switchboard"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdRtnToMainMenu_Click:
Exit Sub
Err_cmdRtnToMainMenu_Click:
MsgBox Err.Description
Resume Exit_cmdRtnToMainMenu_Click
End Sub