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!

A very difficult DataReport!

Status
Not open for further replies.

Magosoft

Programmer
Nov 9, 2001
7
GT
Can I Do this In VB DataReport and How?

Doc....Date.......InAmt......OutAmt......Balance
001..01/01/2001....150.....................150..
002..02/01/2001.................80..........70..
003..03/01/2001.................40..........30..
004..04/01/2001.....50......................80..
005..05/01/2001.................35..........45..

Where Balance is a calculated field that shows the result depending if the operation is an add (InAmt) or Substract (OutAmt).

I have to show this in a VB Data Report.

Please, somebody can help me?

Thank You

Mago
 
I have found data reports very limiting, but if you require to use them I would create a temporary table and populate it with the exact data you require in your report.
It should be simple enough table to populate.

If you original data table has the following fields do something like this

dim rsOrig as new adodb.recordset ' for original data
dim rsNew as new adodb.recordset 'create in data format required
dim lBalance

rsOrig.open "Select * from table1 order by Doc asc",dbConn
while not rsOrig.eof
rsNew.addnew
rsNew("Doc")=rsOrig("Doc")
etc etc fill in rest of fields
if not (isnull(rsOrig("InAmt") then
lBalance=rsOrig("InAmt") + lBalance
else
lBalance=lBalance - rsOrig("OutAmount")
end if
rsNew("Balance") = lBalance
rsNew.Update
rsOrig.movenext

wend

Or something like that
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top