B
Brian W
I have a form where I have a number of totals I would like to calculate (see
below for details). The calculations are done in VBA (because they pull
information from various places) and placing the return value into a textbox
on the form. I am trying to get the calculations to update whenever a field
is changed on the form (there are a number of textboxes). I can get the
onChange event to fire correctly and process correctly. I am pulling the
values from some of the textboxes on the form to pass to the calculation
routine. To do that I have to use textbox.value property (to use .text, the
textbox has to have the focus). the problem is that I'm not getting correct
results this way, the value doesn't update as it is entered, you have to
begin entering in the next box to update the previous one. Is there
something I can do so that this will calculate correctly AS the person types
so that the calculation is correct and updating in real-time (as they type).
Thanks in advance for any help.
Brian w.
Calculations
txtCostA.value = CalculateA(txtbox1.value, txtbox2.value)
txtCostB.value = CalculateB(txtbox3.value, txtbox4.value)
function CalculateA(viNumber1, viNumber2) as single
CalculateA = viNumber1 * viNumber2 * otherValue 'otherValue pulled from
another unrelated table via sql
end function
below for details). The calculations are done in VBA (because they pull
information from various places) and placing the return value into a textbox
on the form. I am trying to get the calculations to update whenever a field
is changed on the form (there are a number of textboxes). I can get the
onChange event to fire correctly and process correctly. I am pulling the
values from some of the textboxes on the form to pass to the calculation
routine. To do that I have to use textbox.value property (to use .text, the
textbox has to have the focus). the problem is that I'm not getting correct
results this way, the value doesn't update as it is entered, you have to
begin entering in the next box to update the previous one. Is there
something I can do so that this will calculate correctly AS the person types
so that the calculation is correct and updating in real-time (as they type).
Thanks in advance for any help.
Brian w.
Calculations
txtCostA.value = CalculateA(txtbox1.value, txtbox2.value)
txtCostB.value = CalculateB(txtbox3.value, txtbox4.value)
function CalculateA(viNumber1, viNumber2) as single
CalculateA = viNumber1 * viNumber2 * otherValue 'otherValue pulled from
another unrelated table via sql
end function