I am try to use an array in a recordset, but I keep getting the "Item not found in this collection" error, which I assune to mean it cannot interpret the variable name. here is part of my code:
dim arAccSalary as variant, arSalary as Variant, ArAccSalaryC as control
'*********store control names in arrays
arAccSalary = Array(AprSalaryAcc, MaySalaryAcc, ...etc
arSalary = Array(AprSalary, MaySalary, JunSalary, ...etc
'****************************************
'set controls to controlnames
Set ArAccSalaryC = arAccSalary(i)
Set ArNIC = ArNI(i)
Set ArSalaryC = arSalary(i)
Set RS = Me.RecordsetClone
With RS
.MoveFirst
Do Until .EOF
.Edit
For i = 0 To 11
If i = 1 Then 'first job
!ArAccSalaryC = !arSalary(i) 'This is the problem
!SalaryAcc = !Salary
Else
!ArAccSalaryC = arThisSalary(i) + !arSalary(i)
End If
I have included only the relevant part of the code. I have tried using quotes and brackets but cannot find the right syntax.
Any help greatly appreciated.
Rick
Lead Developer
dim arAccSalary as variant, arSalary as Variant, ArAccSalaryC as control
'*********store control names in arrays
arAccSalary = Array(AprSalaryAcc, MaySalaryAcc, ...etc
arSalary = Array(AprSalary, MaySalary, JunSalary, ...etc
'****************************************
'set controls to controlnames
Set ArAccSalaryC = arAccSalary(i)
Set ArNIC = ArNI(i)
Set ArSalaryC = arSalary(i)
Set RS = Me.RecordsetClone
With RS
.MoveFirst
Do Until .EOF
.Edit
For i = 0 To 11
If i = 1 Then 'first job
!ArAccSalaryC = !arSalary(i) 'This is the problem
!SalaryAcc = !Salary
Else
!ArAccSalaryC = arThisSalary(i) + !arSalary(i)
End If
I have included only the relevant part of the code. I have tried using quotes and brackets but cannot find the right syntax.
Any help greatly appreciated.
Rick
Lead Developer