My sql statement for query
SELECT [Tbl-SKS].LNAME, [Tbl-SKS].IDNO, [Tbl-SKS].BRNCD, [Tbl-SKS].MODCD,
[Tbl-SKS].CRLINE, [Tbl-SKS].FCCD, [Tbl-SKS].PRLINE, [Tbl-SKS].PRTYP,
[Tbl-SKS].ACNO, [Tbl-SKS].LNAMT, [Tbl-SKS].GRSBAL, [Tbl-SKS].NET_BAL,
[Tbl-SKS].COLMTH, [Tbl-SKS].ARRAMT, [Tbl-SKS].ARRMTH, [Tbl-SKS].NPLFLG,
[Tbl-SKS].NETIIS, [Tbl-SKS].NETPRO, [Tbl-SKS].CATCD, [Tbl-SKS].CATDESC,
[Tbl-SKS].LSTCOLDT, [Tbl-SKS].FSTRLSEDT, [Tbl-SKS].APRDT,
[Tbl-SKS].MARKOFFICER, [Tbl-SKS].UNDRAWN, [Tbl-SKS].PENAMT
FROM [Tbl-SKS]
WHERE ((([Tbl-SKS].CATCD)="HL"))
ORDER BY [Tbl-SKS].NET_BAL DESC;
I tried to use vba as suggested but i got this error "compile error-method
or data member not found" and item .txtLineCount was highlighted.
John Spencer MVP said:
Post the SQL statement of the query you are using in the report and you can
use that to limit the return to the top 20 per branchcode.
Another way is to use VBA to hide the rows in the report that you don't want
to print.
Add a new control to the detail section of your report
Name it TxtLineCount
Set its source to =1
Set its running total to Over Group
In the Format event of the detail add VBA code
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Section(acDetail).Visible = (Me.txtLineCount <= 20)
End Sub
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
zyus wrote:
How to limit number of rows in report group by branchcode.
In my report, i grouped by branchcode (header) and netbalance (desc). I want
to limit the row up to 20, showing account with highest netbalance.
Thanks