I have a main form with a tabbed subform inserted in it. The main form only has a lookup combo box that finds records based on the name of person I type in the combo box. The tabbed subform has three "subforms" and I'm having problems with the Contact Information subform. When I enter a name that doesn't exist in the database, I want the lookup form to automatically split and insert the name I typed in, into the subform. Whenever this happens, I get the error message, "fsubContactInfo is not open".
Here's full code I wrote. The problem line is the "DoCmd" (line 9). Can anyone help me with this?
Private Sub cboNameLookup_NotInList(NewData As String, Response As Integer)
' Move to LastName Field if name is not listed.
Dim ctl As Control
Dim strFirstName As String
Dim strLastName As String
Set ctl = Me![cboNameLookup]
Response = acDataErrContinue
DoCmd.GoToRecord acDataForm, "fsubContactInfo", acNewRec
strLastName = Mid(NewData, 1, InStr(NewData, Chr(44)) - 1)
Debug.Print "First name:" & strFirstName
strFirstName = Mid(NewData, InStr(NewData, Chr(32)) + 1)
Debug.Print "Last name:" & strLastName
Me!FirstName = strFirstName
Me!LastName = strLastName
cmdRefresh.Visible = True
cmdCancel.Visible = True