简体   繁体   中英

How to make all gridlines/borders consistent in Microsoft Access Report

I have this really frustrating problem that may or may not be fixable due to an access technicality, but I'm going to ask anyway.

On a report, I have multiple subreports that display a list of documents; and the information within those subreports are outlined by a grid, so that it looks like the documents are in a table.

My problem is, if I have the border of these objects too close, then sometimes the gridline/border outline is thicker in some areas and not in others. Why is this? It's making the report look really inconsistent and unpresentable.

The only way to combat this, is to leave a space between the object and the border section of the form. But then this means the documents are split and look like they are in their own tables, rather than one big table if this makes sense?

I can't seem to find any solutions to this at all. I'd be very grateful if you know how to fix this or can provide an alternative solution!

Please see the attached images:

UPDATE: I'd just like to add, that when I view the report in 'Report View'; it is presented correctly. This inconsistency only appears when I view it in 'Print view' or if I export it.

这显示了如果我在对象和表单边框之间留出空隙,报表的外观。创建一个在每个文档之间分割的表格,但各行的宽度/颜色/粗度一致

此图显示,当我没有任何缝隙时,表格看起来已连接且完整。但是,有些线比其他线粗/粗。

我无法重叠文档,因为它只是一个对象,代表一个表中的所有文档

Unfortunately, I was unable to find a simple answer as to why access creates these inconsistencies. However, I did find a workaround which solves the issue.

Used this as a reference: https://msdn.microsoft.com/en-us/library/office/aa221362(v=office.11).aspx

  • Add a horizontal line underneath the objects on the report. This will separate the document rows
  • To get the vertical lines, I had to insert them via VBA code. This is because I was unable to get vertical lines to expand when the objects grow

     Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer) Dim ctrl As Control Dim intLineMargin As Integer ' This is the spacing between the right edge of the ' control and the Vertical Seperation Line intLineMargin = 0 

Loop through each control in the detail section of the subreport by selecting their Tags. The first object (Document) has an extra step, because you need vertical lines on both the left and right side.

First if statement creates the line on the left and right side for all controls with the tag 'DocumentName' (In this case, only the first object)

    For Each ctrl In Me.Section(acDetail).Controls
        With ctrl

            If ctrl.Tag = "DocumentName" Then

                Me.Line (0, 0)-(0, 0 + .Height + 150)

                Me.Line ((.Left + .Width), 0)-(.Left + .Width + intLineMargin, .Height + 150)
            End If

The rest of the objects have the tag 'DocumentDetails', and only need vertical lines on the RIGHT side of them. The if statement creates these vertical lines:

        If ctrl.Tag = "DocumentDetails" Then
        Me.Line ((.Left + .Width), 0)-(.Left + .Width + intLineMargin, .Height + 150)
        End If

    End With
Next

Set ctrl = Nothing


End Sub

Result: All lines are now consistent

一致的表格线

I wonder what would happen if you make the subreports be in datasheet view?

Otherwise I'd normally play around with line thicknesses, and make sure the control, section and subform heights were set exactly, and use the align tool to push your subreports together.

Or, as a last resort, I'd scrap the whole thing and load the pieces into a table and then make a subreport based off that. But I don't know what your stipulations are.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM