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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 424 Object Not Found on db.execute Insert

Status
Not open for further replies.

CarolCook

IS-IT--Management
Mar 7, 2003
158
US
I am using the following code on a combo box for a NotOnList event. For some reason, VB chokes on the Insert statement with the 424 error. Thanks in advance.

Private Sub Combo44_NotInList(NewData As String, Response As Integer)
'Ask the user if they want to add to the list
If MsgBox("This equipment does not exist. Do you want to add it?", vbYesNo + vbQuestion, "Add new value?") = vbYes Then

'The user clicked Yes - add the new value
db.Execute "INSERT INTO [Equipment List] (Equipment) VALUES (""" & NewData & """)", dbFailOnError

'Tell Access you've added the new value
Response = acDataErrAdded

Else

'The user clicked No - discard the new value
Me.Combo44.Undo
'Tell Access you've discarded the new value
Response = acDataErrContinue

End If

db.Close


End Sub
 
What is db ?
Have you tried CurrentDb instead ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Oops. Have changed to currentdb. But the insert still doesn't work. It drops right through to the error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top