J
Jenna B
I have a combo box based on a query that will allow a user to select a name
from the list. If the name is not in the list, the Not In List event will run
the following code, and add the name that they entered to tblContacts.
However, I need more information (such as phone number, job title, etc.) and
I want the form to open to that specific record so that they can finish
adding information. I have successfully gotten the form to open, but not to
the record that was just added.
I greatly appreciate your help!
_____________________________________
Private Sub Combo39_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
If NewData = "" Then Exit Sub
Msg = " ' " & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Would you like to add this person as a contact?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Contact...")
If i = vbYes Then
strSQL = "Insert Into tblContacts ([ContLName]) values ('" &
NewData & "')"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
DoCmd.OpenForm "frmNewContact", , , , acFormEdit
Else
Response = acDataErrContinue
End If
End Sub
from the list. If the name is not in the list, the Not In List event will run
the following code, and add the name that they entered to tblContacts.
However, I need more information (such as phone number, job title, etc.) and
I want the form to open to that specific record so that they can finish
adding information. I have successfully gotten the form to open, but not to
the record that was just added.
I greatly appreciate your help!
_____________________________________
Private Sub Combo39_NotInList(NewData As String, Response As Integer)
Dim strSQL As String
Dim i As Integer
Dim Msg As String
If NewData = "" Then Exit Sub
Msg = " ' " & NewData & "' is not currently in the list." & vbCr & vbCr
Msg = Msg & "Would you like to add this person as a contact?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Unknown Contact...")
If i = vbYes Then
strSQL = "Insert Into tblContacts ([ContLName]) values ('" &
NewData & "')"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
DoCmd.OpenForm "frmNewContact", , , , acFormEdit
Else
Response = acDataErrContinue
End If
End Sub