NotInList not firing ?

G

gator

this code is not firing for some reason....any ideas?

'Adds a new vendor if one does not exist yet in the Vendors Table
Private Sub TranVendorName_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String

strMsg = "'" & NewData & "' is not an available Vendor Name " & vbCrLf &
vbCrLf
strMsg = strMsg & "Do you want to add it?"

If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("Vendors", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!VendorName = Me.TranVendorName.Text
rs.Update

If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If

End If

rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top