none
MS Access Report and DrawWidth RRS feed

  • Question

  • I know virtually nothing about VB. I need to draw a rectangle around the detail and page footer sections in MS Access reports. The below draw the rectangle but I cannot figure out how to use the DrawWidth correctly. I'm setting the below ScaleMode to inches, but I need pixel control over the border, preferably 3 px. Can anyone get me going in the right direction?

    Thanks!

    Private Sub Report_Page()
        Dim rpt As Report, lngColor As Long
        Dim sngTop As Single, sngLeft As Single
        Dim sngWidth As Single, sngHeight As Single
        Set rpt = Reports!ReportName
        ' Set scale to 0 for pixels, 5 for inches
        rpt.ScaleMode = 5
        ' Top inside edge.
        sngTop = rpt.ScaleTop + 2
        ' Left inside edge.
        sngLeft = rpt.ScaleLeft + 0
        ' Width inside edge.
        sngWidth = rpt.ScaleWidth + 0
        ' Height inside edge.
        sngHeight = rpt.ScaleHeight + 0
        ' Make color red.
        lngColor = RGB(255, 0, 0)
        ' Set line thickness
        rpt.DrawWidth = 1
        ' Draw line as a box.
        rpt.Line (sngLeft, sngTop)-(sngWidth, sngHeight), lngColor, B
    End Sub

    Thursday, May 2, 2019 3:15 PM