Assigning fields to variables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I need to do a lot of calculations on fields within a form but I need to
perform the calculations without 'hard coding' the field names, eg

for i = 1 to 20
sField = "Field" & cstr(i)
.............
next i

The problem I have is updating the field specified in variable sField.

I have tried using

For Each Control In Me.Controls
if control.name = sField then
...........
end if
next control

but this seems very inefficient, is there a better way to do this?

Many thanks for any help.
 
Back
Top