Running Sum on DataReport

 

Hye Guys,
       I am a beginer programmer.. I have started 2 build a simple database application. I am now in the stage of showing the data in reports 2 print. I am suggested to use datareport available in VB. I also did my some of the report in it. It worked fine. But now I am stucked in one step..of displaying the calculateable field in the detail section..

Eg. in database:

Item       Type              Qty
A            Pur                 10
A            Sal                   3
A            Pur                   6
A            Pur                   2
A            Sal                   5

In Report

Item       Type              Qty          BALQty
A            Pur                 10               10
A            Sal                   3                  7
A            Pur                   6               13
A            Pur                   2               15
A            Sal                   5               10

Plz Help me...

Always ready 2 learn..
Kabindra Bakey




Answer this question

Running Sum on DataReport

  • offordscott

    Hi,
          I am really sorry that I couldn't get the Layout view of the report designer. As I already said I am a beginer, I performed the following steps. So if there is any mistake u plz help me.

    Steps:
    1.) Added New Dataenvironment to my project
    2.) Managed the properties of the connection and pointed to my database. Test Connection also preceeded.
    3.) Added New Command object to the connection.
    4.) In Properties of the Command Object Managed its Name to TestObj and Its Database object to table and then ObjectName to the Name of Table.
    5.) Save and Quit.
    6.) Added New DataReport to my Project
    7.) Set its DataSource to DataEnvironment
    8.) Set its DataMember to the TESTObj
    9.) Now Right CLicked on the DataReport and Click on Retreive Structure.
    10.) Created text Controls for the Each of the Columns to be displayed.
    11.) Now but I couldn't draw the Function control in the detail section.


    So plz Help me..



  • Tyler M

    BALQty expression could be

    =RunningValue(iif(Fields!Type.Value="Pur",Fields!Qty.Value,-Fields!Qty.Value),Sum,Nothing)



  • Kyle Pawlaczyk

    In Report Designer (Layout view)

  • r2d1

    Hi,
          Thanks for your king reply. but I am confused that where should I write that expression Code ... Either in the query Builder of VB or the View of SQL Server

    Hoping for your kind information..

    Always Ready 2 Learn
    Kabindra Bakey



  • stoppedcode12

    Are you using Report Designer or something else


  • KYoung

    I am using Data Report Designer that is available in VB6

  • Running Sum on DataReport