I am converting from DAO to ADO in Access 2002 and using MS SQL2000 for my back end and when I run this code I get the error for the line I have colored red below; "Current recordset does not support updating. This may be a limitation of the provicer, or of the selected locktype."
The table is updateable, at least I can open it in Access and append new records and delete and update exitisting records.
The table is updateable, at least I can open it in Access and append new records and delete and update exitisting records.
Code:
Dim rstItems As Recordset, rstSchdlItems As Recordset, [COLOR=Blue]rstItemItems As Recordset[/COLOR]
Dim strItems As String, strSchdlItems As String
Dim lngOldItemTblItemID As Long, lngNewItemTblItemID
strItems = "SELECT T_Schedule_ProductionItems.ItemID, T_Schedule_ProductionItems.OrigID, T_Schedule_BatchItems.OrigID, T_Schedule_BatchItems.ItemID " & _
"FROM T_Schedule_ProductionItems INNER JOIN T_Schedule_BatchItems ON T_Schedule_ProductionItems.OrigID = T_Schedule_BatchItems.OrigID"
Set rstItems = CurrentProject.Connection.Execute(strItems)
Set rstSchdlItems = CurrentProject.Connection.Execute("T_Schedule_ProductionSchedule")
[COLOR=Blue]Set rstItemItems = CurrentProject.Connection.Execute("T_Schedule_ProductionItems")[/COLOR]
If rstItems.BOF = False Then '** records were found that need synch
rstItems.MoveFirst
Do
lngOldItemTblItemID = rstItems.Fields(0) '*[T-Schedule-ProductionItems].ItemID = 0
lngNewItemTblItemID = rstItems.Fields(3) '* [T-Schedule-BatchItems].ItemID = 3
'updating tbl T-Schedule-ProductionItems
rstItemItems.Find "[ItemID] = " & lngOldItemTblItemID
If rstItemItems.EOF = False Then '** found record with matching ID
[COLOR=Red]rstItemItems.Fields("ItemID") = lngNewItemTblItemID[/COLOR]
rstItemItems.Update
End If
rstSchdlItems.Find "[ItemID] = " & lngOldItemTblItemID
If rstSchdlItems.EOF = False Then '** found record with matching ID
Do
rstSchdlItems.Fields("ItemID") = lngNewItemTblItemID
rstSchdlItems.Update
rstSchdlItems.Find "[ItemID] = " & lngOldItemTblItemID
Loop Until rstSchdlItems.EOF = True
End If
rstItems.MoveNext
Loop Until rstItems.EOF = True '** we have passed the last record in the recordset
End If
rstItems.Close
rstSchdlItems.Close