Don't store the commission in a column the table. As Quantity and Rate are
stored values in other columns in the same row in the table then there is no
need to store the commission in a separate row as it can always be obtained
via a commuted control as you are doing, or by a computed column in a query.
If you did store it in a separate column in would be functionally dependent
on the two non-key columns Quantity and Rate, so the table would not be
correctly normalized and at risk of inconsistent data. Non-key columns
should be functionally dependent solely on the key of the table - 'The key,
the whole key and nothing but the key, so help me Codd' - which Quantity and
Rate are, but Comm would not be.
I don't see why you need to run a macro here. All you need is a form based
on the Sales (or whatever) table with two bound textboxes for Quantity and
Rate, and an unbound Comm text box with your expression as its ControlSource
property.
If you are using an unbound form for any reason, you would insert a row into
the table via code or a macro, but you'd only need to insert values into the
Quantity and Rate columns, not a Comm column for the reasons described in
para 1 above.
Ken Sheridan
Stafford, England
On a form, I am doing a simple calculation based on values in two Textboxes:
=[QUANTITY]*[RATE]
This is a commission (TextBox is named COMM). I enter data into several
Textboxes, and run a small macro to bind the data to a table. Everythign
updates fine, except the COMM TextBox. How do I bind this to the table so
all records update appropriately?
Thanks!
Ryan--