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

Make Subreport Look Like a Table 1

Status
Not open for further replies.

mkallover

Programmer
Feb 6, 2008
88
US
I'm trying to figure out how to make a subreport look like a table. It contains about five fields, one of which is a Description field with the "Can Grow" property set to Yes. This field can vary from one sentence in length to several paragraphs.

My first try consisted of putting a border around each field and putting them together to make it look tabular. The only issue with that is when I have a long Description field the border around it (obviously) is stretched but the other fields are not so the table looks a little wonky.

I figure there has to be a way to do this but I can't figure it out.
 
You need to remove all of the borders and use the Line method in the On Print event of the section containing the text boxes. Place the word "Border" in the Tag property of every control in the section you want to have a border.

Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Dim intMaxHeight As Integer
    Dim ctl As Control
    'Find highest control in Detail section _
      that has a tag property of "Border"
    For Each ctl In Me.Section(0).Controls
        If ctl.Tag = "Border" Then
            If ctl.Height > intMaxHeight Then
                intMaxHeight = ctl.Height
            End If
        End If
    Next
    'Draw a box around each control in Detail _
      that has a tag property of "Border"
    For Each ctl In Me.Section(0).Controls
        If ctl.Tag = "Border" Then
            Me.Line (ctl.Left, ctl.Top)- _
                Step(ctl.Width, intMaxHeight), vbBlack, B
        End If
    Next
End Sub


Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top