M
mcjanes
I have a simple Search dialog box with a text box...the user types in a
student number, clicks a command button and the student's information
pops up in the Student form.
How do I get the dialog box to close when the user clicks the command
button? I know I have to use this code in the command button's OnClick
event, but where does it go?:
' Close Dialog Box.
DoCmd.Close
Here is the code for the OnClick event:
Private Sub cmdSearchStudent_Click()
On Error GoTo Err_cmdSearchStudent_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_Students"
stLinkCriteria = "[s_StudentID]=" & "'" & Me![txtSearchForm] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdSearchStudent_Click:
Exit Sub
Err_cmdSearchStudent_Click:
MsgBox Err.Description
Resume Exit_cmdSearchStudent_Click
End Sub
student number, clicks a command button and the student's information
pops up in the Student form.
How do I get the dialog box to close when the user clicks the command
button? I know I have to use this code in the command button's OnClick
event, but where does it go?:
' Close Dialog Box.
DoCmd.Close
Here is the code for the OnClick event:
Private Sub cmdSearchStudent_Click()
On Error GoTo Err_cmdSearchStudent_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_Students"
stLinkCriteria = "[s_StudentID]=" & "'" & Me![txtSearchForm] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdSearchStudent_Click:
Exit Sub
Err_cmdSearchStudent_Click:
MsgBox Err.Description
Resume Exit_cmdSearchStudent_Click
End Sub