Background: Front end MS Access 2010/VBA; Back end MS SQL Server 2008
I have a situation where one SQL table (dbo_BDItems) is being read, some data is being extracted and placed in a second table (dbo_BDBudgets) .
I am getting this Error# 3146
ODBC--call failed. It happens on the .Update statement.
Can anyone tell me where I am making a mistake? Thanks
I have a situation where one SQL table (dbo_BDItems) is being read, some data is being extracted and placed in a second table (dbo_BDBudgets) .
I am getting this Error# 3146
ODBC--call failed. It happens on the .Update statement.
Can anyone tell me where I am making a mistake? Thanks
Code:
dim FY as string
FY = "30"
Dim rs As DAO.Recordset
Dim db As Database
Set db = CurrentDb
Set rs = CurrentDb.OpenRecordset("dbo_BDItems", dbOpenDynaset, dbSeeChanges)
Dim rs2 As DAO.Recordset
Dim db2 As Database
Set db2 = CurrentDb
Set rs2 = CurrentDb.OpenRecordset("dbo_BDBudgets", dbOpenDynaset, dbSeeChanges)
If rs.RecordCount <> 0 Then
rs.MoveFirst
While Not rs.EOF
With rs2
.AddNew
.Fields("FY") = FY
.Fields("Item") = rs.Fields("Item")
.Update
End With
rs.MoveNext
Wend
End If
Comment