Form's textbox writes value to table

splatt_

New member
Local time
Today, 10:02
Joined
Jan 29, 2009
Messages
4
I have a form with cmbProductCode, txtPurchasePrice, txtQtyOrdered and txtTotalCost.

The value of txtTotalCost is =[txtPurchasePrice]*[txtQtyOrdered].

This form writes to tblOrders. ProductCode and QtyOrdered are being recorded just fine. But of course, TotalCost is not.

Question:
Is there a way for me to write thru VBA for App so that the value to txtTotalCost is written to tblOrder's TotalCost field?
 
actually, due to normalization rules you would not normally store that information since you have stored the price and quantity and therefore you can calculate the total at anytime with a query. It can cause referential integrity issues if you store the calculated data and then your underlying data changes somehow and then the total doesn't get updated.
 
That makes sense. But I'm really very new to all these. I know very little about making queries. Would you be kind enough to point me to somewhere where I can make that suggestion of yours work for me? A tutorial in this forum perhaps?
 
What do you need? if you are looking to get the data out for a report, base the report off of a query instead of the table (which you should do anyway). Then you can include in the query:

MyTotal:[YourField1NameHere]*[YourField2NameHere]

or essentially like that.
 

Users who are viewing this thread

Back
Top Bottom