What is the easiest way to close a previous form when opening a new form?
I have tried macro and coding and both do not work for me. In the macro I first close the form then open the new form. Why doesn't this work?
In coding/modules, this is my code:
Private Sub Check16_GotFocus()
On Error GoTo Err_Check16_GotFocus
Dim Form1Name As String
Dim form2name As String
Dim LinkCriteria As String
Form1Name = "Selecting TP Variations"
form2name = "TP Analysis Selection"
DoCmd.OpenForm Form1Name, , , LinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, form2name
Exit_Check16_GotFocus:
Exit Sub
Err_Check16_GotFocus:
MsgBox Error$
Resume Exit_Check16_GotFocus
End Sub
Why doesn't this work?
Thank you for your help.
I have tried macro and coding and both do not work for me. In the macro I first close the form then open the new form. Why doesn't this work?
In coding/modules, this is my code:
Private Sub Check16_GotFocus()
On Error GoTo Err_Check16_GotFocus
Dim Form1Name As String
Dim form2name As String
Dim LinkCriteria As String
Form1Name = "Selecting TP Variations"
form2name = "TP Analysis Selection"
DoCmd.OpenForm Form1Name, , , LinkCriteria
DoCmd.Maximize
DoCmd.Close acForm, form2name
Exit_Check16_GotFocus:
Exit Sub
Err_Check16_GotFocus:
MsgBox Error$
Resume Exit_Check16_GotFocus
End Sub
Why doesn't this work?
Thank you for your help.