I have a search form which passes the criteria in a query and opens the form frmKeyWordResults when I click on Perform Search button. I want to close the search when when Perform search button is clicked. I tried to put DoCmd.Close in my code but then my search doesn't work properly. Where should I place it to close the form.
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim stDocName As String
Dim stLinkCriteria As String
'Docmd.Close
stDocName = "frmKeyWordResults"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim stDocName As String
Dim stLinkCriteria As String
'Docmd.Close
stDocName = "frmKeyWordResults"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub