Not very elegant but you could do your select as you are now but with an 
additional column for the running balance (0 as runbal) - do the select 
into a temp table/cursor then do a SCAN ... ENDSCAN to fill in the 
values for the running balance ?

James E Harvey wrote:
> We want to create a grid that "simulates" the look of an Excel file that has
> a column that is a "running" total of two other columns.
>
> I can't make this work in a grid using the table itself, so I'm trying to
> create a cursor to use as the data source of the grid.
>
> Table structure is:
>
> Pk_cash       auto increment primary key
> Date_serv     date
> Comp_id       c       3
> Dep_dis       n       11      2
> Type_entry    c       3
>
> Sample data:
>
> 1
> 02/01/2007
> SHS
> 1,000.00
> DEP
>
> 2
> 02/01/2007
> SHS
> 500.00
> DIS
>
> 3
> 02/02/2007
> SHS
> 2,000.00
> DEP
>
> 4
> 02/03/2007
> SHS
> 200.00
> DIS
>
>
> Results desired in the grid:
>
> Date                  Deposits        Disbursements   Balance
> 02/01/2007            1,000.00                                1,000.00
> 02/01/2007                            500.00          500.00
> 02/02/2007            2,000.00                                2,500.00
> 02/03/2007                            200.00          2,300.00
>
> The grid is read only, data will be added, edited in typical form with text
> boxes.
>
> The select below is missing the "running balance" column, and nothing I've
> tried has worked.
>
> SELECT cb.pk_cash, cb.date_serv,
> SUM(IIF(cb.type_entry="DEP",cb.dep_dis,0000000.00)) as deposit,
> SUM(IIF(cb.type_entry="DIS",cb.dep_dis,0000000.00)) as disburse  FROM
> cashbal cb WHERE cb.COMP_ID = 'SHS' GROUP BY cb.pk_cash, cb.date_serv ORDER
> BY cb.date_serv
>
> James E Harvey
> Hanover Shoe Farms, Inc.
> M.I.S./Corresponding Officer
> Off: 717-637-8931
> fax: 717-637-6766
> email: [EMAIL PROTECTED]
>
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to