I have created a button on my form that opens another form showing linked data. Having opened the second form I would like the first form to close, but cannot seem to get it to work. I have tried various different bits of code but none seem to work.
The code I have for the button at the moment (which does work insofar as opening the second form showing the correct record) is:
Code:
Private Sub Proceed_Click()
On Error GoTo Err_Proceed_Click
DoCmd.RunCommand acCmdSaveRecord
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmCustOrd1"
stLinkCriteria = "[OrderID]=" & Me![OrderID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Proceed_Click:
Exit Sub
Err_Proceed_Click:
MsgBox Err.Description
Resume Exit_Proceed_Click
If Me.Dirty Then Me.Dirty = False
End Sub
Can anyone tell me what I need to add in and at what point to make the first form close?