Greetings, need assistance understanding what I am doing to generate the above error using Access 2007.
My goal is to cycle thru field collection of rstA which contains 79 fields. For each record in rstA, I want to create a new record in rstB using rstA.fields 0-19 plus 1 field beginning at field 20. Ideally, I should create 60 rstB records for each rstA record.
Fields 0-19 of rstB structure are the same as rstA. Just need to update rstB field 20 while cycling from rstA fields 20-79.
I have been stumped for several days trying to work thru this but unable to resolve. Any assistance would greatly be appreciated. Also, I understand the complaint is likely from rstB being nested under rstA's "with" statement. Have tried nested "with" statements without success.
code snippet
My goal is to cycle thru field collection of rstA which contains 79 fields. For each record in rstA, I want to create a new record in rstB using rstA.fields 0-19 plus 1 field beginning at field 20. Ideally, I should create 60 rstB records for each rstA record.
Fields 0-19 of rstB structure are the same as rstA. Just need to update rstB field 20 while cycling from rstA fields 20-79.
I have been stumped for several days trying to work thru this but unable to resolve. Any assistance would greatly be appreciated. Also, I understand the complaint is likely from rstB being nested under rstA's "with" statement. Have tried nested "with" statements without success.
code snippet
Code:
With rstA
Do Until rstA.EOF
For y = 20 To rstA.Fields.Count - 1
For i = 0 To 19
rstB.AddNew
rstB.Fields(i) = rstA.Fields(i)
Next
rstB.Fields(20) = rstA.Fields(y)
rstB.Update
Next
rstA.MoveNext
Loop
End With