Dear Friends
I have a script attached to a control in form. In the "Code" control, if it is not in list, I want to close current "Service" form, then open the "ClientIntake" form. In the "ClientIntake" form, I will enter the value in "Code" field. These two forms, "Service" and "ClientIntake" forms are link by "Code" field.
The following script does not working well. Can somebody help me?
Private Sub Code_NotInList(NewData As String, response As Integer)
On Error GoTo Err_Code_NotInList
Dim stDocName As String
Dim stLinkCriteria As String
response = acDataErrDisplay
DoCmd.Close
stDocName = "ClientIntake"
'DoCmd.stDocName.Visible = True
response = acDataErrDisplay
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Code.SetFocus
Exit_Code_NotInList:
Exit Sub
Err_Code_NotInList:
MsgBox Err.Description
Resume Exit_Code_NotInList
End Sub
I have a script attached to a control in form. In the "Code" control, if it is not in list, I want to close current "Service" form, then open the "ClientIntake" form. In the "ClientIntake" form, I will enter the value in "Code" field. These two forms, "Service" and "ClientIntake" forms are link by "Code" field.
The following script does not working well. Can somebody help me?
Private Sub Code_NotInList(NewData As String, response As Integer)
On Error GoTo Err_Code_NotInList
Dim stDocName As String
Dim stLinkCriteria As String
response = acDataErrDisplay
DoCmd.Close
stDocName = "ClientIntake"
'DoCmd.stDocName.Visible = True
response = acDataErrDisplay
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
Code.SetFocus
Exit_Code_NotInList:
Exit Sub
Err_Code_NotInList:
MsgBox Err.Description
Resume Exit_Code_NotInList
End Sub