I need to set the on-click property of a text box to complete 2 functions. Firstly, it must open a form corresponding to the value in the field. Secondly, it must close the current form.
The code I have now does the 1st function perfectly. How can I add the Close form (current form name is frmViewPatients) function into this code?
------------------------------------------
Private Sub Health_Care_No_Click()
On Error GoTo Err_Health_Care_No_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPhysician"
stLinkCriteria = "[Health_Care_No]='" & Me![Health_Care_No] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
'Open frmPhysician for this patient when you click on his/her health care number.
Exit_Health_Care_No_Click_:
Exit Sub
Err_Health_Care_No_Click:
MsgBox Err.Description
Resume Exit_Health_Care_No_Click_
End Sub
------------------------------------------
Thanks!
The code I have now does the 1st function perfectly. How can I add the Close form (current form name is frmViewPatients) function into this code?
------------------------------------------
Private Sub Health_Care_No_Click()
On Error GoTo Err_Health_Care_No_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPhysician"
stLinkCriteria = "[Health_Care_No]='" & Me![Health_Care_No] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
'Open frmPhysician for this patient when you click on his/her health care number.
Exit_Health_Care_No_Click_:
Exit Sub
Err_Health_Care_No_Click:
MsgBox Err.Description
Resume Exit_Health_Care_No_Click_
End Sub
------------------------------------------
Thanks!