Assigning fields to variables
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.
.
Relevant Pages
- Re: Assigning fields to variables
... Brendan Reynolds (MVP) ... > I need to do a lot of calculations on fields within a form but I need to ... > The problem I have is updating the field specified in variable sField. ... > For Each Control In Me.Controls ... (microsoft.public.access.forms) - Re: Null values and calculations
... You can use the IIf() expression in the Control Source of a text box. ... another cause of #Error is calculated expressions when the report has no records. ... >> messages where this formaul was being used in a calculations. ... (microsoft.public.access.reports) - RE: form/ subform calculation
... it's control source. ... of the calculations underlying fields gets changed, the result stays the same, ... F-CutlistDetail subform, and use the calculated field in the query as the ... control source for [PCS]. ... (microsoft.public.access.formscoding) - RE: General question on an event
... you have a control that shows the total square feet. ... Dave Hargis, Microsoft Access MVP ... I would suggest the applied tax rate be stored in the table at the line item ... the Calculations txtbox and when it changes it will update the txtSalesTax ... (microsoft.public.access.formscoding) - Re: Refreshing Data on a subform
... Try using the AfterUpdate event of the *form* (not the control) to requery ... Use the Requery if you need to get your other subform to reload its data ... > the calculations on frmC, but I want the screen to update automatically, ... (microsoft.public.access.forms) |
|