Hello! I'm trying to create a report, in which all of the textbox
controls in Detail section I'd like to resize to one size.
Here is a code (Access 2000):
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim c As Control
Dim MaxH As Long
On Error GoTo 999
MaxH = MaxHeight(Me.Section(acDetail))
SetControlsHeight Me.Section(acDetail), MaxH
999:
Err.Clear
End Sub
'-----
Public Function MaxHeight(sec As Section) As Long
Dim c As Control
Dim MaxH As Long
On Error Resume Next
For Each c In sec.Controls
If c.Visible = True Then _
If MaxH < c.Height Then MaxH = c.Height
Next c
MaxHeight = MaxH
End Function
'-----
Public Sub SetControlsHeight(sec As Section, H As Long)
Dim c As Control
On Error Resume Next
For Each c In sec.Controls
If c.Visible = True Then
c.Height = H
End If
Next c
End Sub
As a result I get a row, containing textbox controls with variable
heights.
What's wrong with my code?
Thanks!