I have created a form with a combo box that looks up values in tblFrequency.
If the value is new I want to add it to the table and I have tried couple scripts I found online but it always comes out with an error. This is script that i would like as I seem to understand it more or less:
However with this and other one I tried error is shown and debugger shows this line selected: Dim db As Database
Any ideas on what could be the problem? I am using Access 2000
If the value is new I want to add it to the table and I have tried couple scripts I found online but it always comes out with an error. This is script that i would like as I seem to understand it more or less:
Code:
Private Sub Update_frequency_NotInList(NewData As String, Response As Integer) Dim db As Database Set db = CurrentDb 'Add the new value to the field db.Execute "INSERT INTO tblFrequency (Update_Frequency) VALUES (""" & NewData & """)", dbFailOnError 'Tell Access you've added the value Response = acDataErrAdded db.Close Set db = Nothing End Sub
Any ideas on what could be the problem? I am using Access 2000
Comment