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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

put a calculated field frm a form in a table 1

Status
Not open for further replies.

aliceapraham

Technical User
Apr 9, 2007
38
US
i have a form that has records from multiple tables, like Companyname (table), Salesman (table2), Products (table3), now, in my form i have a calculated field, that has the product, Wty & total so i want that form to be saved in a table (which will be (Table4), that has Total, product Qty fields in it,
how do i do that, how i link a form to a table.
I am grabbing some infos from multiple tables but i cann't put the extra new fields in a table.
thank you
Alice
 
You do not save calculated fields. Nor do you duplicate fields across tables. See:
The Fundamentals of Relational Database Design
Quoting from the article:
"An obvious example of a dependency is a calculated column. For example, if a table contains the columns Quantity and PerItemCost, you could opt to calculate and store in that same table a TotalCost column (which would be equal to Quantity*PerItemCost), but this table wouldn't be 3NF.
 
I don't want to put a calculated field in a table.
The calculated field is in my form, but i want to put the result of that calculation in a table, that's the problem.
Alice
 
What I've done in the past is to create a button, such as Calc that when pressed will calculate the equation. Under the Mouse press event, you will want to add some VBA code. It is very simple. E.G. Lets say I have a field in Table1 called price, and another in Table2 called quantity, and I want to multiply these two and place them in Table3 at column amount. All I would have to do is use this code:

[Table3.amount] = [Table1.price] * [Table2.quantity]

So you reference to which table you want followed by a Period, then the location in the table. Pretty straight forward.
 

I don't want to put a calculated field in a table.
The calculated field is in my form, but i want to put the result of that calculation in a table


The difference being??


Randy
 
randy700 - thank you.
gadget3302 - Normaliaztion? Protocols of Access? The very reason for Access being?
 
gadget3302:Your posting was intresting but i couldn't ymake it work.
i put a cmd button, & that button should take FROM the FORM I have a field called calculated (which does the calculations in it), I want that field to be referenced (PUt IN a Table) . Tbe saved in a table How do i do that?
Alice
 
Alice,
What the posts above are trying to tell you is that calculated values are not normally saved in a database. If you can calculate it on a form, you should be able to do the same calculation in a report or in a query when you want to display that information. For example if I have a field with date of birth information I do not need to store the persons age in a field. I can display age information in a form, report, or query by calculating the values dynamically any time I want.
 
Oh.... now I get it thank you MajP, & all who were trying to help.
So I can save that field in a report, but will it be saved in the form also everytime i open it up? & new records added.
Alice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top