Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# total money have in a grid column

Posted on 1999-06-30
Medium Priority
139 Views
How can i calculate or get the total of a currency value in a grid COLUMN.
ex.
price

100.00
300.00
150.00
======
550.00
0
Question by:mvalez
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 4

LVL 12

Accepted Solution

rwilson032697 earned 40 total points
ID: 1385600
Try this in a TQuery:

Select Total as Sum(Price) from TheTable

Then you will have one row in the result set with one field with the value you want!

OR you can run through all the rows yourself and add them up like this

Total := 0
while not Query.EOF do
begin
Total := Total := Query.FieldsByName['Price'].AsFloat;
Query.Next;
end;

Cheers,

Raymond.
0

LVL 12

Expert Comment

ID: 1385601
Err.. THe second := should be a +     :-(
0

Author Comment

ID: 1385602
Thank you very much...
0

LVL 12

Expert Comment

ID: 1385603

Cheers,

Raymond.
0

LVL 12

Expert Comment

ID: 1385604
Hmm...

I think this:

Select Total as Sum(Price) from TheTable

Select Sum(Price) as Total from TheTable

Cheers,

Raymond.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
###### Suggested Courses
Course of the Month8 days, 16 hours left to enroll