Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not In List Error on ADP Form

Status
Not open for further replies.

MelissaKT

Technical User
Jun 22, 2004
95
US
Hello! I would appreciate any help! I have an adp form that has a "Vendor Name" combo box. The combo box is bound to a vendor table. The form that the combo box is on is actually unbound. Anyway, I have an "On Not In List" event that fires when a new vendor is put into the combo box. However, it doesn't seem to be working. I'm not sure why. Here is the code that I have. It works fine in other databases, just not this one!
Code:
Private Sub cboVendor_NotInList(NewData As String, Response As Integer)
On Error GoTo HandleErrors
    DoCmd.SetWarnings False
    DoCmd.RunSQL "INSERT INTO tblVendor (VendorName) Values ('" & SQLFixup(NewData) & "');"
        Response = acDataErrAdded
    Me.cboVendor.Requery
ExitHere:
    Exit Sub
HandleErrors:
    MsgBox err.Number & " " & err.Description
    Resume ExitHere
End Sub

SQLFixup is code off of the microsoft web site that formats the new data. Again, this works fine in other databases. When I try to use this, I get the error "THE TEXT YOU ENTERED ISN'T AN ITEM IN THE LIST." Obviously, if the code worked, I wouldn't get this message.

When I go to the table, the item has been entered. How exactly do I take care of this issue? Why doesn't it recognize the acDataErrAdded variable?

Thank you in advance for any help!
[ponytails2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top