How to calc values from table and then display in textbox

Ben2k

Board Regular
Joined
Oct 16, 2002
Messages
77
Lets say I have this simple table

Code Value

A 500
B 600
C 400

I have a form (or a report) with a text control.

When the form/report opens I want the total of the value column in the text control.

Thanks

Ben
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Re: How to calc values from table and then display in textbo

If your field is actually named "Value", then insert a Text Box in the Report Footer of your report and in the Control Source of the Text Box enter the formula:

=Sum([Value])
 
Upvote 0
Re: How to calc values from table and then display in textbo

Okay thanks, what would happen though if there were two tables, both with a value field?

How could I refer to a specific field in a specific table?

Thanks
 
Upvote 0
Re: How to calc values from table and then display in textbo

A report can only be run of one table, or one query. So if you wanted a report that had information from two tables, you would need to link the data from the two tables in a query and use the query as the control source of your report.

Now, if you have a field name that exists in both tables, you simply need to specify which table in the calculation, i.e.
=Sum([Table1]![Value])
 
Upvote 0
Re: How to calc values from table and then display in textbo

Thanks,

Can a form contain data from more than one table or query?

Ben
 
Upvote 0
Re: How to calc values from table and then display in textbo

As I said in my last post, a report can only be run from one table, or one query. However, that is really not a limiting factor, because you can combine an unlimited amount of tables and queries in a query.

If you have two tables, simply link the two tables together in a query, and then use this query as the Control Source for your report.
 
Upvote 0

Forum statistics

Threads
1,221,773
Messages
6,161,855
Members
451,724
Latest member
sledparty

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top