I have the following code in my not in list.
Code:
Private Sub trbFinancialItem_NotInList(NewData As String, Response As Integer)
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 & "Do you want to add it to the list?"
i = MsgBox(Msg, vbQuestion + vbYesNo, "Financial Item List...")
If i = vbYes Then
strSQL = "Insert Into tlkpFinancialItems ([tiItem]) " & _
"values ('" & NewData & "');"
CurrentDb.Execute strSQL, dbFailOnError
Msg = "'" & NewData & "'has been added to the list, click to resume."
i = MsgBox(Msg, vbOKOnly, "Financial List Update")
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
It works great however when I click the second msg box it moves to the next record, I copied this code from the Internet and think I may have made some changes that cause this problem.
Can someone advise how to modify the code so it stays on the same record after the item is added?