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!

Can Grow Shrink Min Height 1

Status
Not open for further replies.

naturalsn

Technical User
Apr 26, 2007
68
GB
Good Morning

I was hoping someone could maybe assist.

I currently have three fields on a report sitting right next to one another

Doc Reference No Of Copies Description

No Of copies and Description only appear ones on the report but can vary from 1 line of detail to 5 lines of detail.
(All in one text box - Made the text box very heigh)

I have set the No of copies and description to can grow and shrink.. .

To not show all the lines if there are no records in the two fields.

The detail in the No Of copies wich is normally a number only fills on line
Where the Description is normally on two or three lines.
(my colums are quite big to allow everything to fit.)

Because i set the Text boxes of the two to can grow shrink, the No of copies are normally smaller than my description box and loos the table like layout.

I was wondering if it is possible to set n minimum heigth to what your record can shrink to if there is detail in it.

Thank you very much in advance

Regards
Susan
 
So you have a bunch of contols in the detail of your report and I am guessing you have some sort of border turned on that gives you a table like effect.

But because of the growing and shrinking your text boxes end up different heights.

A solution to this is to not use borders and instead use lines.

The trick with this is getting the vertical lines to vary in height.

On the Section's on format event you should be able to set the height property of each of the vertical lines to the same height as the description textbox (assuming it will always be tallest. I suspect this will also work for the other text boxes instead of lines but you might have to turn off the can shrink proerty of those text boxes.

Let us know it you need more help to get started.
 
lameid is close to correct however the height of a grown control can't be determined in the On Format event. You must wait for the On Print Event. I would remove the control borders and add the word "border" to the tag property of each control in the detail section that I want to have a border around. 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
Hook'D on Access
MS Access MVP
 
Thank you Both very much for the help..
I eventually got it sorted..

Regards
Susan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top