This FOR loop takes approx 8.5 seconds to populate 96 text boxes. I need to get this down to 1 second. Possible??
What is taking this thing so long???? There are only 20 iterations in the loop. What in this code is the holdup???
Why is it that a db grid will populate sooo much faster????
Adapting a db grid to my app would be a monumental chore.
Any help??
Thank You.
For n = 0 To 199 Step 10 'Step 10 provides index for 1st column text box for ea row.
If objSource.adoRsPyrlCalc2.EOF = True Then Exit For
i = n 'Load fields from recordset into text boxes. Below loads
'one row.
txt1(i).Text = objSource.adoRsPyrlCalc2!WAGENAME
i = i + 1
txt1(i).Text = objSource.adoRsPyrlCalc2!WageNo
'Load array and advance index for use in proc CalcGross and
'proc PostWageTypes.
WageNos(A) = objSource.adoRsPyrlCalc2!WageNo
If A = 20 Then 'If this is twentieth wage then no more WageNos to store.
'Do not increment array index for next array WageNos.
Else
A = A + 1 'Do increment A if A is less than 20. If this is last
'wage being loaded then A will be 1 larger than
'last wage number loaded into array WageNos.
End If
i = i + 1
txt1(i).Text = objSource.adoRsPyrlCalc2!DEPT
i = i + 1
'txt1(i).Text = objSource.adoRsPyrlCalc2! (Future Use)
i = i + 1
txt1(i).Text = objSource.adoRsPyrlCalc2!WRATE
'Pass WAGENO and i to procedure PostWageTypes.
PostWageTypes objSource.adoRsPyrlCalc2!WageNo, i
'This bookmarks the record for each row of textboxes by using the
'Txt1 index of the WRATE textbox as an item(index) of the
'bookmark array to bookmark each record.
'The Txt1 WRATE Gotfocus event then calls the bookmark to make
'that row of textboxes the current record and then binds the
'WRATE textbox so that the user can then edit the WRATE textbox.
BkMrk(i) = objSource.adoRsPyrlCalc2.Bookmark
i = i + 5
txt1(i).Text = objSource.adoRsPyrlCalc2!YTD_AMT
objSource.adoRsPyrlCalc2.MoveNext 'Iterate through all wages for employee.
Next n
TNN, TOM
TNPAYROLL@AOL.COM
TOM
What is taking this thing so long???? There are only 20 iterations in the loop. What in this code is the holdup???
Why is it that a db grid will populate sooo much faster????
Adapting a db grid to my app would be a monumental chore.
Any help??
Thank You.
For n = 0 To 199 Step 10 'Step 10 provides index for 1st column text box for ea row.
If objSource.adoRsPyrlCalc2.EOF = True Then Exit For
i = n 'Load fields from recordset into text boxes. Below loads
'one row.
txt1(i).Text = objSource.adoRsPyrlCalc2!WAGENAME
i = i + 1
txt1(i).Text = objSource.adoRsPyrlCalc2!WageNo
'Load array and advance index for use in proc CalcGross and
'proc PostWageTypes.
WageNos(A) = objSource.adoRsPyrlCalc2!WageNo
If A = 20 Then 'If this is twentieth wage then no more WageNos to store.
'Do not increment array index for next array WageNos.
Else
A = A + 1 'Do increment A if A is less than 20. If this is last
'wage being loaded then A will be 1 larger than
'last wage number loaded into array WageNos.
End If
i = i + 1
txt1(i).Text = objSource.adoRsPyrlCalc2!DEPT
i = i + 1
'txt1(i).Text = objSource.adoRsPyrlCalc2! (Future Use)
i = i + 1
txt1(i).Text = objSource.adoRsPyrlCalc2!WRATE
'Pass WAGENO and i to procedure PostWageTypes.
PostWageTypes objSource.adoRsPyrlCalc2!WageNo, i
'This bookmarks the record for each row of textboxes by using the
'Txt1 index of the WRATE textbox as an item(index) of the
'bookmark array to bookmark each record.
'The Txt1 WRATE Gotfocus event then calls the bookmark to make
'that row of textboxes the current record and then binds the
'WRATE textbox so that the user can then edit the WRATE textbox.
BkMrk(i) = objSource.adoRsPyrlCalc2.Bookmark
i = i + 5
txt1(i).Text = objSource.adoRsPyrlCalc2!YTD_AMT
objSource.adoRsPyrlCalc2.MoveNext 'Iterate through all wages for employee.
Next n
TNN, TOM
TNPAYROLL@AOL.COM
TOM