I have a combo box in a form that allows the users to put in new info if it isn't in the box. I have done this right many times with no problem, but now I get an error,...can you tell me why?? Here is the code:
the cbobox is "Heardfromus" and the lookup table is "tblHeardfromus"...the cbobox has it's "limit to list" set to YES....it's calling an error on the Dim DB as Database....
start of code---------------
Private Sub Heardfromus_NotInList(NewData As String, Response As Integer)
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordSet("tblheardfromus")
rst.AddNew
rst!Heardfromus = NewData
rst.Update
Response = acDataErrAdded
rst.Close
End Sub
the cbobox is "Heardfromus" and the lookup table is "tblHeardfromus"...the cbobox has it's "limit to list" set to YES....it's calling an error on the Dim DB as Database....
start of code---------------
Private Sub Heardfromus_NotInList(NewData As String, Response As Integer)
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordSet("tblheardfromus")
rst.AddNew
rst!Heardfromus = NewData
rst.Update
Response = acDataErrAdded
rst.Close
End Sub