Macros

  • Thread starter Thread starter J
  • Start date Start date
J

J

I know this is probably a simple question but it slipped my mind how to
do it. I was wondering how i could create a macro that would allow 2
fields to be multiplied together and the result be displayed in a
separate text box on the same form.
 
No macro is needed. All you need to do is create an unbound text box (that
is, one that isn't tied to a field in your underlying table) and put your
formula in the Control Source of the textbox. Example:

Suppose you had two text boxes Text1 and Text2 and you want their multiplied
value to show in Text3. Put the following in the ControlSource property of
Text3:
=Text1*Text2

That's all.

Now before you ask how to store this value back to the table, the answer is
*you don't*! Calculated values are rarely stored in a table. Simply
re-calculate them (in a form, report, or query) whenever you need that
value. This ensures the value is always correct.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Back
Top