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
'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