Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bold format on top & bottom 10% of records in a report

Status
Not open for further replies.

jvanderw

Technical User
Aug 13, 2003
28
US
Hey all,
I want to make the top & bottom 10% of the records of a report bold (if there are 100 records the first 10 and last 10 records will be bold). Is there a way to do this???
Thanks in advance,
Josh
 
You can make a query that determines the top 10%, then another that determines the bottom 10%, then join them with the main query/table that is the recordsource of your report, and if they match make a calculated field that designates which items match, then on your report use this field to decide which are bold.

If you still need help:
what is your report's recordsource? how is "TOP" or "BOTTOM" determined? By a date? Providing your code will help us help you.

What if whatever you sort by has duplicates? i.e. you sort by a date, and there are 10 11/15/04. is that your 10%? or do you want to group by the date (or whatever you sort by) and only show one 11/15/04 along with 9 other dates?

Also please supply data examples: what you have and what you want it to look like.

Thanks.
 
Another alternative to use totally within the report is

Create a text box in the detail section:
Name: txtSeq
Control Source: =1
Running Sum: Over All
Visible: No

Create a text box in the Report Header section:
Name: txtCountAll
Control Source: =Count(*)
Visible: No

Then add code to the On Format event of the detail section:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim dblPosition As Double
    Dim ctl As Control
    On Error Resume Next
    dblPosition = Me.txtSeq / Me.txtCountAll
    For Each ctl In Me.Detail.Controls
        ctl.FontBold = (dblPosition < 0.1 Or dblPosition >= 0.9)
    Next
End Sub

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Thanks, there's always multiple methods to arrive at the same end result.


Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top