Hi all,
I routinely use the combo box’s NotInList event to open a different data entry form in add mode, ready for the user to input the entry.
What I can’t seem to figure out is the code to do the same thing in a subform. In the code below, the user enters a matter number that’s not in the list. If he responds yes to the prompt, the frmClients form (which has a fsubMatters subform) opens up and goes to a specific Client number record. The fsubMatters subform however is still at its first record for that Client number. What I want to do is go to a new record (add a record) in the subform. This is the part I can’t figure out.
‘********************** START CODE **********************
Private Sub cboMatterNum_NotInList(NewData As String, Response As Integer)
Dim iAnswer As Integer
iAnswer = MsgBox(“Matter number does not exist. Add (Yes/No)?”, vbYesNo + vbQuestion)
If iAnswer = vbYes Then
If IsLoaded(“frmClients”) Then
DoCmd.Close acForm, “frmClients”
End If
DoCmd.OpenForm “frmClients”, acNormal, , “[ClientID] = ‘” & cboClientNum.Value & “‘”, acEdit, acDialog
‘*** Now, need to go to new record (add new record) in fsubMatters subform
‘*** How do I do this???
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
‘********************** END CODE **********************
Thanks,
Stephan