I am new to Microsoft ADP files and just discovered that my code that used to work in an mdb file does not work in an adp project.
I am using the following code to try to add new records to the database
I get the error Object Variable or With Block variable not set on the line Set rs = db.OpenRecordset("NextTaskCriteria")
I am using the following code to try to add new records to the database
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim var As Variant
Set db = CurrentDb
Set rs = db.OpenRecordset("NextTaskCriteria")
For Each var In Me.lstSources.ItemsSelected
With rs
.AddNew
.Fields("Source") = CLng(Me.lstSources.Column(0, var))
.Fields("EmployeeID") = Me.SelectedEmployeeID
.Update
End With
Next
MsgBox "Updated successfully...", vbInformation
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
I get the error Object Variable or With Block variable not set on the line Set rs = db.OpenRecordset("NextTaskCriteria")