Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Commiting form field data to database

Status
Not open for further replies.

cantech2

Instructor
Oct 18, 2003
21
US
Hello,

I have a form called BILLS with a field called LABILL
I also have a subform called LABTEST with a calculation field called TOTAL.

I have set the value of LABBILL to be euqal to the calculated value in TOTAL.

The above works well on the form but does not show up on displayed on the form but is not committed to the database.

How can I commit the value in LABBILL to the database. If there is a change in the calculated value of TOTAL, LABBILL will change on the form, I hope the new value will overwrite the old value in the database.

Thanks,
Humphrey.
 
You are storing derived values in your database ?
This is often considering as a bad practice.
Calculated values should be set within queries or report to preserve accuracy.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Humphrey

Following up on PHV (Super Tek of the week - congrats PH), For the very reason you are posting your question is why storing calculations breaks one of the rules for normalization of a relational database...
If there is a change in the calculated value of TOTAL, LABBILL will change on the form, I hope the new value will overwrite the old value in the database

Fortunately, you can calcualte the value every time you view the form or run a report. A common approach is to include an unbound field on the form or report, and use DSUM as the control source...

DSUM ("[FieldUsedForCalc]", "[YourTable]", "[IDfield] = " & YourMatchingID)

For example, for an sales order invoice...

DSUM("[SalesQty]*[SalesPrice]", "OrderDetailTbl", "[InvoiceNo] = " & InvoiceNo)

Richard
 
willir,
first: thanks for the nice words about me
second: thanks for your jump in this thread to add some clarity.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top