-Frontend Access 2010
-Backend tables are in SQL Server 2017
I get the error at rs4.AddNew. The first part of the code loops through the parent records then jumps to another sub to add child records. the first parent record is added with child record with no problem but at the second record of the parent table the error occurs. theres nothing particularly special about the second record. This use to work flawlessly when both backend and frontend was Access
Any ideas?
-Backend tables are in SQL Server 2017
Code:
Set rs = db.OpenRecordset("SELECT * FROM tbltable1", dbOpenSnapshot, dbSeeChanges)
Set rs1 = db.OpenRecordset("SELECT * FROM tbltable2 ", dbOpenDynaset, dbSeeChanges)
BeginTrans
rs.MoveFirst
Do Until rs.EOF
rs1.AddNew
rs1.Fields("LUID") = rs.Fields("LUID")
rs1.Update
varBook = rs1.LastModified
rs1.Bookmark = varBook
'\\set variables IDs
FeeID = (rs1.Fields("FeeID").Value)
FeeLUID = rs1.Fields("FeeLUID").Value
PopulateDataStage FeeLUID, FeeID 'go to sub
Code:
Sub PopulateDataStage(i, x)
Dim db As Database
Dim rs3 As Recordset
Dim rs4 As Recordset
Set db = CurrentDb
Set rs3 = db.OpenRecordset("SELECT * FROM tbltable WHERE ID=" & i, dbOpenSnapshot, dbSeeChanges)
Set rs4 = db.OpenRecordset("SELECT * FROM tbltable2", dbOpenDynaset, dbSeeChanges)
BeginTrans
Do Until rs3.EOF
[B][COLOR="Red"]rs4.AddNew[/COLOR][/B]
rs4.Fields("") = rs3.Fields("")
rs4.Fields("") = rs3.Fields("")
rs4.Update
rs3.MoveNext
Loop
CommitTrans
rs3.Close
rs4.Close
Set rs3 = Nothing
Set rs4 = Nothing
I get the error at rs4.AddNew. The first part of the code loops through the parent records then jumps to another sub to add child records. the first parent record is added with child record with no problem but at the second record of the parent table the error occurs. theres nothing particularly special about the second record. This use to work flawlessly when both backend and frontend was Access
Any ideas?