Mu user wants to query the access DB with Excel, and he wants to be able to bring all the field values into Excel. Can what he wants be done?
thx
Main Topics
Browse All TopicsI have 3 form fields, Qty, UnitCost and TotalCost. In the control property for TotalCost I have:
=[Qty]*[UnitCost] and it works great, however I want to ALSO store in the table the value of TotaalCost. Since the control property is already populated with the calculation, where do I put the table field I want to store the value in. Can both the calculation and table field name be put on the control line, and if so what is the syntax. or does it go somewhere else?
thx experts...-Bob
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Ok, create a new query:
Create a new query in design view -> Design View (OK) -> highlight the table and press Add. Then close the dialog box. Now double click the * from the top of the box that represents your table. Now, below, in the row names "Field" goto the 2nd column from the left (first blank one) and type: TotalCost: [Qty]*[UnitCost]
save the query and there we go :-)
Dave
Sure ... but it's pretty much what Dave posted here:
http:#a23986549
mx
ok ... in looking at your Test.mdb ... if you want to go the calculated field approach, the remove the field 'Total' from Table1 - and keep the expression you created
Total: [Qty]*[Unit]
which will always display the calculated value. You can't have both a Field in the table called Total and an Expression called Total.
So ... you have to decide on one approach (the BeforeUpdate - save the value) OR the calculated value - which ever best fits your situation.
Give Flavo some pts here because he showed the query approach.
Note that the query approach was not intended to 'update' the Total field in your table and save the result ... but only to *display* the calculated value.
mx
I understand that mx, what my originl problem was, I was trying to create a report, from my data entry form, and only fields bound to a table field were showing up, and I wanted to show all the calculated fields on the report. Flavo told me to create a query first, then make the report based on the query and I wuold get my calculated fields. He gave me the following:
[ Ok, create a new query:
Create a new query in design view -> Design View (OK) -> highlight the table and press Add. Then close the dialog box. Now double click the * from the top of the box that represents your table. Now, below, in the row names "Field" goto the 2nd column from the left (first blank one) and type: TotalCost: [Qty]*[UnitCost]
save the query and there we go :-)
Dave ]
I tried it, and it wasn't working, so I posted the screen shots in the prior post (query1 / query2.jpg) showing what I did, and the query still not calculating the total. This is what I am still stuck on. I would rather not store te calculated fields, but I do need to show the on the report.
thx...Bob
Ok ... in the query design grid ... you will have a series of 'expressions' - generically like so:
MyCalc1: [Qty]*[Unit] MyCalc2: [Qty2]*[Unit2] MyCalc3: [Qty3]*[Unit3] .....
that will result in SQL that looks like this:
SELECT Table1.*, [Qty]*[Unit] AS MyCalc1, [Qty2]*[Unit2] AS MyCalc2, [Qty3]*[Unit3] AS MyCalc3
FROM Table1;
Of course, I selected the entire Table1 (*) here - which you many not want ... and ... I'm using made up names for your various fields to be used in the calculations, etc.
MyCalc1, MyCalc2, MyCalc3 ... etc ... would be the (calculated) field names you would bring down in the report.
OR ... you could just create text boxes on the report with the same calculations ... like so:
=[Qty]*[Unit]
=[Qty2]*[Unit2]
=[Qty3]*[Unit3]
which is probably the better approach for a report .... just supply the raw data in the table to the report ... and let the report do the work ...
mx
Business Accounts
Answer for Membership
by: flavoPosted on 2009-03-25 at 18:23:52ID: 23986526
There's no (or very minimal reasons) need to store a calculated fields in a table - that's what queries and calculated controls are for.
Why would you need to store this value, I'm sure queries will be the solution to your problems.
Dave