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

notinlist error....

Status
Not open for further replies.

mjonson

Technical User
Mar 9, 2004
128
GB
when this add to combo code is fired i get a variable undefined error on the first line.
surely this is defining the variables itself?

Private Sub taskcombo_NotInList(NewData As String, Response As Integer)
Dim Db As DAO.Database
Dim Rs As DAO.Recordset

DoCmd.SetWarnings (warningsoff)
If MsgBox("OK to add new Task type.?. Or Press Cancel to Discard", vbOKCancel + vbwarning, "Add Equip Type?") = vbOK Then
Set Db = CurrentDb
Set Rs = Db.OpenRecordset("tbl_task", dbOpenDynaset)
' On Error Resume Next
Rs.AddNew
Rs![task] = NewData

Rs.Update

Set Db = Nothing
' Continue without displaying default error message.
Response = acDataErrAdded
Else
DoCmd.SetWarnings (warningsoff)
Response = acDataErrContinue
Me.Undo

If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
Me!taskcombo.Requery
End If
End Sub
 
only thing is this code works in my access2000 DB - but now i am trying to run from a 97
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top