Good Day Experts!
The end is in site for my little conversion project. This is the last part of the code that has errors. I just am not sure how the VB6 constructs are working here to follow a couple parts in the code.
***tblRS is a detached “table” recordset populated in code above this block
***SQLrs2 is a recordset from a query farther up in the code
I just don’t understand looping on tblRS since once inside the Loop for SQLrs2
tblRS.Find is executed. Also, I cannot follow the MoveNext, First and Last near
Can you help translate?
Do Until tblRS.EOF = True
Do Until SQLrs2.EOF = True
tblRS.Find "[GL CODE]='" & SQLrs2("GL CODE") & "'"
Debug.Print "[GL CODE]='" & SQLrs2("GL CODE") & "'"
If tblRS.EOF = True Or tblRS.BOF = True Then
Debug.Print "NOT FOUND ADDING " & SQLrs2("GL CODE")
'Not found add new record...
Dim fieldsArray1(2) As Variant
fieldsArray1(0) = "GL CODE"
fieldsArray1(1) = "TotalPaid"
fieldsArray1(2) = "TotalWeight"
Dim values1(2) As Variant
values1(0) = SQLrs2("GL CODE")
values1(1) = SQLrs2("TotalPaid")
values1(2) = SQLrs2("TotalWeight")
tblRS.AddNew fieldsArray1, values1
'Add the total paid to the Original Query results
tblRS("TotalPaid") = CDec(tblRS("TotalPaid").Value) + CDec(SQLrs2("TotalPaid").Value)
tblRS("TotalWeight") = CDec(tblRS("TotalWeight").Value) + CDec(SQLrs2("TotalWeight").Value)