On Mon, 10 Jul 2006 23:42:38 GMT, "RICHARD BROMBERG" <no*****@att.netwrote:
>I have a form with thirty text boxes.
Each of them has an input mask of 99.
In each text box the user enters a numeric score in the range from 0 to 99.
As each text box loses focus I want to perform a calculation involving all
the numbers (ok the string representation of the numbers) . It doesn't
matter which text box loses focus, the calculation is the same.
Can I declare (define) a subroutine (Procedure ?) and call it from the lost
focus event of each text box .
I suspect I can but when I looked for details I couldn't find any.
Thanks
In the form's module create a FUNCTION.
'================================================= ======
Function fDoCalc()
'write your routine here to do whatever calculations you require.
Me.txtResult = Me.txt1 + Me.txt2 + Me.txt3
End Function
'================================================= ======
In the property sheet of the form, select each of your 30 text boxes and in the
LostFocus event put -
=fDoCalc()
The function will be triggered each time any of the text boxes loses the focus.
Wayne Gillespie
Gosford NSW Australia