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!

Only some things grow 1

Status
Not open for further replies.
Jul 6, 2005
52
GB
I have a report that contains an item description and other fields that are numeric. I have set the CanGrow properties of all fields and the section to yes but when the item description grows, the other fields don't grow with it unless they need to. I am using the field border property so the printed result reveals fields of different heights when some fields grow and others don't and this makes the report look messy.

Any suggestions on how to make all fields in the section grow when one or more needs to?
 
Since it is a report and once you display the data, you don't need formats like date/time and integer. I would convert them to string and pad them with spaces so the field would grow.

This is just a quick and dirty way to do it. There are programmatic solutions that would involve resizing the controls at the same time at runtime.
 
Don't display any borders. Use the Line method in the On Print event of the detail section to draw the lines around your text boxes. Assuming you have a bunch of text boxes in the detail section:
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Dim intMaxHeight As Integer
    Dim ctl As Control
    'find the tallest control in the details section
    For Each ctl In Me.Section(0).Controls
        If ctl.Height > intMaxHeight Then
            intMaxHeight = ctl.Height
        End If
    Next
    'draw rectangle around each control
    '  with height = to max height
    For Each ctl In Me.Section(0).Controls
        Me.Line (ctl.Left, ctl.Top)- _
            Step(ctl.Width, intMaxHeight), , B
    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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top