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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Border around Report?

Status
Not open for further replies.

pelbert

Programmer
Nov 8, 2004
2
US
This is an easy one. My reporting background is more in Crystal, so I am trying to figure out if I can simply put a border around the entire page of a report. If so, how can I also change border width? Does anyone one have a simple solution?
 
A simple rectangle can be drawn with the Line method in the On Page event of the report.

A cool box with rounded corners can be drawn with code.

Place this code in a standard module and save the module as "basReportFunctions". You can call the function in the On Format of a section or in the On Page event.
Code:
Sub RoundCornerBox( _
        lngWidth As Long, _
        lngHeight As Long, _
        lngTop As Long, _
        lngLeft As Long, _
        lngRadius As Long, _
        rptReport As Report)
    'call this from a report with syntax like
    '
    'Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    '    RoundCornerBox 4000, 6000, 100, 200, 300, Me
    'End Sub

    Dim sngStart As Single
    Dim sngEnd As Single
    Dim dblPI As Double
    dblPI = 3.14159265359

    'Top Left
    sngStart = 2 * dblPI * 0.25 ' Start of pie slice.
    sngEnd = 2 * dblPI * 0.5    ' End of pie slice.
    rptReport.Circle (lngLeft + lngRadius, _
            lngTop + lngRadius), _
            lngRadius, vbBlue, sngStart, sngEnd
    'Top line
    rptReport.Line (lngLeft + lngRadius, lngTop)- _
        (lngLeft + lngWidth - lngRadius, lngTop)

    'Top Right
    sngStart = 2 * dblPI * 0.000001
    sngEnd = 2 * dblPI * 0.25
    rptReport.Circle (lngLeft + lngWidth - _
            lngRadius, lngTop + lngRadius), _
            lngRadius, vbBlue, sngStart, sngEnd
    'right line
    rptReport.Line (lngLeft + lngWidth, _
        lngTop + lngRadius)- _
        (lngLeft + lngWidth, _
        lngTop + lngHeight - lngRadius)

    'Bottom right
    sngStart = 2 * dblPI * 0.75
    sngEnd = 2 * dblPI
    rptReport.Circle (lngLeft + lngWidth - _
        lngRadius, lngTop + lngHeight - lngRadius), _
        lngRadius, vbBlue, sngStart, sngEnd
    rptReport.Line (lngLeft + lngRadius, _
        lngTop + lngHeight)- _
        (lngLeft + lngWidth - lngRadius, lngTop + lngHeight)

    'Bottom Left
    sngStart = 2 * dblPI * 0.5
    sngEnd = 2 * dblPI * 0.75
    rptReport.Circle (lngLeft + lngRadius, _
        lngTop + lngHeight - lngRadius), _
        lngRadius, vbBlue, sngStart, sngEnd
    'right line
    rptReport.Line (lngLeft, lngTop + lngRadius)- _
        (lngLeft, lngTop + lngHeight - lngRadius)

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]
 
This sounds like a terrific option.

I tried it with Access 2000. Is it specific to a version of Access?

_____________

Cliff
 
This code should work in any version of Access. Did you get an error message? Didn't it work for you?

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