Access Form Calculations

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I make a calculation on two form entries and have that calculation update to the main table

Expample: Sales Entry Cost Entry Gross Profit ( Sales - Cost

Thank You
 
You do not need to store Gross Profit on the table as you
have its constituents.

Gerald Stanley MCSD
-----Original Message-----
How do I make a calculation on two form entries and have
that calculation update to the main table.
 
You really shouldn't store calculated information in a table, but if you
really must here is a way.

On your form have 3 text boxes xSales, xCost, and xProfit; each with its
control source set to the 3 corresponding fields. Then in the code for the
afterupdate event of xSales and xCost enter the following.

xProfit = xSales - xCost

This will past the result of xSales - xCost into the xProfit box. I said to
put the code in both locations so that changing either one will update the
results. You should also make xProfit locked and unenabled so the user
doesn't manually modify the result.

Kelvin
 
Back
Top