making all the text box grow the same size

basilyos

Registered User.
Local time
Today, 05:54
Joined
Jan 13, 2014
Messages
256
hello

i maked a report that contains 10 textboxes beside each other and i changed the option (can grow) of the textboxes to yes
the growing is okay

but i want all the textboxes to grow the same size as the bigger one

any help?
 
I can't tell you exactly how to do this, but where you would do it is in the format event for the section in which the textboxes exist.

You would need to determine which text box has grown the most (perhaps by seeing which control has the greatest number of characters) and setting the height of all the other textboxes to suit.

I'm not sure whether you can determine the 'grown' height of the control with the greatest number of characters but Steven Lebans has a cangrow function here

http://www.lebans.com/cangrow.htm

which you can probably adapt to your requirements i.e.

turn off the cangrow capability then in your format event

1. determine which control is the largest
2. use Steven Lebans function to grow the control
3. set the other controls to the same height

From experience, the first thing you need to do in the format event is reset all the controls to the required height, including the section

Also be aware that the formatting only happens in report view and not print preview - not a problem if going straight to print
 
thanks my dear i will install office 2003 first so i can open Steven Lebans file and then i will try it
 
i found this solution

Code:
On Error Resume Next
Dim lngCounter As Long, dblMaxHeight As Double
dblMaxHeight = 0
ReDim strcontrol(13)
strcontrol(0) = "txt1"
strcontrol(1) = "txt2"
strcontrol(2) = "txt3"
strcontrol(3) = "txt4"
strcontrol(4) = "txt5"
strcontrol(5) = "txt6"
strcontrol(6) = "txt7"
strcontrol(7) = "txt8"
strcontrol(8) = "txt9"
strcontrol(9) = "txt10"
strcontrol(10) = "txt11"
strcontrol(11) = "txt12"
strcontrol(12) = "txt13"
For lngCounter = 0 To UBound(strcontrol)
If Me(strcontrol(lngCounter)).Height > dblMaxHeight Then dblMaxHeight = Me(strcontrol(lngCounter)).Height
Next
For lngCounter = 0 To UBound(strcontrol)
If lngCounter = 0 Then
Me.Line (Me(strcontrol(lngCounter)).Left, Me(strcontrol(lngCounter)).Top)-Step(Me(strcontrol(lngCounter)).Width, dblMaxHeight), , B
Else
Me.Line (Me(strcontrol(lngCounter)).Left, Me(strcontrol(lngCounter)).Top)-Step(Me(strcontrol(lngCounter)).Width, dblMaxHeight), , B
End If
Next

the result is awesome

but if i have more than one record in the table a small rectangle appear in every line from the second line

any idea how to remove it
 
i found it
ReDim strcontrol(12)
instead of
ReDim strcontrol(13)
 
ReDim strcontrol(12)

For i = 0 to 12
strcontrol(i) = "txt" & cstr(i+1)
Next i


You can also make all in a single For loop
 

Users who are viewing this thread

Back
Top Bottom