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

Need help to add(sum) cells in dataset 1

Status
Not open for further replies.

Koos50

Technical User
Aug 16, 2010
7
0
0
ZA
Hi Everyone,

I am new to the Forum. I also started getting interested in Delphi Programming at a quite late stage of my life.

I need help please : I have a Paradox database with 5 fields - 30d,60d,90d,120d & Total outs. I used DBEDIT boxes on a form to display first 4 fields/ client. How do I add(sum) the first 4 field cells in the row to display as dbedit or Label for Total outs.

I would appreciate any code or effort to help.

Thank you very much
 
this is from memory, should be correct.
Code:
Label1.Text := IntToStr(Table1.FieldByName('30d').AsInteger + Table1.FieldByName('60d').AsInteger + Table1.FieldByName('90d').AsInteger + Table1.FieldByName('120d').AsInteger);

Aaron
 
This worked one shot !!! The only problem I now have is that the label.caption displays the summed currency result as rounded and not as a 2 decimal figure for the currency I used.

Please help me to fix.

Thank you
 
Try FloatToStr instead of IntToStr and .AsFloat not .AsInteger

 
Thank you very much martinm. Excellent!!! This solved my problem.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top