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!

How to expand or shrink the report without losing the report's format

Status
Not open for further replies.

hshaker

Technical User
Jun 29, 2007
66
CA
Hi there,

I have a report with some memo boxes. I created the report very nicely with rectangles and lines so that it looks like my old excel form. Now, here is the problem. I have some memo boxes that can expand and when they do they will screw up the layout of the report. All the controls will move down but the rectangle and the lines won't. Is there any way to fix this?


Thanks a lot.
 
The standard solution is to remove all borders from all controls. Then use code in the On Print event of the report section containing the controls to draw rectangles with the Line method based on the height of the tallest grown text box.

For instance, set the tag property of every control you want to draw a border around to "Border". Then use code like:
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 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