Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - ReportControl SUBSUM
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ReportControl SUBSUM

 Post Reply Post Reply
Author
Message
axdoverm View Drop Down
Groupie
Groupie
Avatar

Joined: 16 August 2008
Location: Netherlands
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote axdoverm Quote  Post ReplyReply Direct Link To This Post Topic: ReportControl SUBSUM
    Posted: 02 August 2010 at 7:00am
Hey Guys,

I hope somebody can help me. If you look in the image below you will see that a have a SUBFORMULA in the reportcontrol with a result in the grouprow (nr. 1)


the SUM is now calculating the kolom (nr. 2) and that works, but i would like to get the SUM result from the last colomn in the report (nr. 3). Too calculate the SUM i use the following code: (i found this code on this forum and addepted to my needs)


CODE EXAMPLE:
Public Sub RapportageOmzetPerKlant(sSQL As Variant)
 '
 On Error GoTo HELL
 '
 Dim Column As ReportColumn
 Dim Record As ReportRecord
 Dim Item As ReportRecordItem
 Dim row As ReportRow
 Dim groupRow As ReportGroupRow
 '
 frmMAIN.ReportControl1.Columns.DeleteAll
 frmMAIN.ReportControl1.Records.DeleteAll
 '
 Set Column = frmMAIN.ReportControl1.Columns.Add(0, "Datum", 100, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(1, "Factuur", 80, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(2, "Aantal", 70, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(3, "Omschrijving", 220, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(4, "St. Prijs", 90, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(5, "Totaal", 100, True)
      Column.Visible = True
 Set Column = frmMAIN.ReportControl1.Columns.Add(6, "KLANT", 0, True)
      Column.Visible = False
      '
   If CNN_DB.state = 1 Then CLOSE_DB_CONNECTION
      '
      OPEN_DB_CONNECTION (sSQL)
        '
        Do Until RST_DB.EOF = True
          '
          Set Record = frmMAIN.ReportControl1.Records.Add()
          Set Item = Record.AddItem(RST_DB.Fields("DATUM") & "")
          Set Item = Record.AddItem(RST_DB.Fields("FACT_NO") & "")
          Set Item = Record.AddItem(RST_DB.Fields("AANTAL") & "")
          Set Item = Record.AddItem(RST_DB.Fields("OMSCHRIJVING") & "")
          Set Item = Record.AddItem(FormatNumber(RST_DB.Fields("ST_PRIJS"), 2) & "")
          Set Item = Record.AddItem(FormatNumber(RST_DB.Fields("REGEL_TOT_INC"), 2) & "")
          Set Item = Record.AddItem(RST_DB.Fields("KLANT") & "")
          '
        RST_DB.MoveNext
        '
      Loop
      '
   If CNN_DB.state = 1 Then CLOSE_DB_CONNECTION
   '
   frmMAIN.ReportControl1.GroupsOrder.Add frmMAIN.ReportControl1.Columns(6)
   frmMAIN.ReportControl1.Populate
   '
   For i = 0 To frmMAIN.ReportControl1.Rows.count - 1
        Set row = frmMAIN.ReportControl1.Rows(i)
        If row.groupRow Then
           Set groupRow = row
           groupRow.GroupFormat = " [Omzet =%.02f]"
           groupRow.GroupFormula = "SUMSUB(C2:C3)"
           groupRow.GroupCaption = "x"
        End If
   Next
   '
   Exit Sub
   '
HELL:
   '
   If CNN_DB.state = 1 Then CLOSE_DB_CONNECTION
   ErrorHandler Err.Number, Err.Description, "modRAPPORTAGE", "RapportageOmzetPerKlant()"
   '

End Sub

If i change the SUMSUB to (F2:F3) i don't get any results, what i'm missing ?? ... i cant figure is out! ... so please HELP ME!

Product: Xtreme SuitePro (ActiveX) version 11.2.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0
Back to Top
markmark View Drop Down
Senior Member
Senior Member


Joined: 30 November 2007
Status: Offline
Points: 142
Post Options Post Options   Thanks (0) Thanks(0)   Quote markmark Quote  Post ReplyReply Direct Link To This Post Posted: 05 August 2010 at 4:45am

Hi

 

I think you need it to be SUMSUB(C6:C7)

 

The "C" is not Col C

 

But I still have problems with this as well, as I cannot get it to calculate for a single row.

 

Please see my test app, where you can enter your formula.

 

Would like to see examples of a single row calculation.

 

Also Why in the above does it calucalte just Col 6 and not col6 and col7?

 

Mark

 
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 07 August 2010 at 4:40am
Originally posted by axdoverm axdoverm wrote:

Hey Guys,
 
[...]
If i change the SUMSUB to (F2:F3) i don't get any results, what i'm missing ?? ... i cant figure is out! ... so please HELP ME!
[...]

 
Hi,
 
You need SUMSUB(R*C5:R*C6) for calculating "Omzet"
 
 
From:
R     =     Row
*     =     Rownumber (* means all rows)
C     =     Column
5     =     Column number (=ItemIndex)
 
To:
R     =     Row
*     =     Rownumber (* means all rows)
C     =     Column
6     =     Column number (=ItemIndex)
 
 
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.