ReportControl SUBSUM |
Post Reply |
Author | |
axdoverm
Groupie Joined: 16 August 2008 Location: Netherlands Status: Offline Points: 14 |
Post Options
Thanks(0)
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 |
|
markmark
Senior Member Joined: 30 November 2007 Status: Offline Points: 142 |
Post Options
Thanks(0)
|
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 |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.... |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |