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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Contol Height 2

Status
Not open for further replies.

danrobson

IS-IT--Management
May 29, 2001
30
GB
I'm confused!

I have a report that in the detail section has a vertical line, and two text boxes with the "Can Grow" property set to yes.

In this example, there are two detail records to be printed, one fits the text box fine, the other requires the text box to grow in order to fit all the info. If I output the height of the text box in the Detail on Format event, both records show the same Height for the text box, if I output the height in the On Print event, then the second text box is show as being bigger as it has expanded to fit the extra info.

Now for my question....Where can I set the height of the vertical line so it matches the height of the text box? If I try and set it in the on format event then the size is not showing as the expanded size? If I try and set the height in the OnPrint event, then I'm told I can't set this protery after printing has started?

Can anyone help?
 
Paste this into your Deatils: On Print:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
On Error Resume Next

Dim intMaxInalt As Integer
Dim intNrControale As Integer
Dim intContor As Integer
Dim intLeftSpace As Integer
Dim bGasitStanga As Boolean
Dim intLineWidth As Integer

intMaxInalt = 0

'## Maxim height of controls
intNrControale = Me.Count
For intContor = 0 To intNrControale - 1
If Me(intContor).Section = 0 Then
If TypeOf Me(intContor) Is TextBox And Me(intContor).Visible = True Then

If intLeftSpace > Me(intContor).Left Or intLeftSpace = 0 Then
If Not bGasitStanga Then
intLeftSpace = Me(intContor).Left
End If
bGasitStanga = True
End If

intLineWidth = intLineWidth + Me(intContor).Width

If Me(intContor).Height > intMaxInalt Then
intMaxInalt = Me(intContor).Height
End If

End If
End If
Next intContor

'First vertical line and the horizontal line
Me.Line (intLeftSpace, 0)-Step(0, intMaxInalt)
Me.Line (intLeftSpace, intMaxInalt)-Step(intLineWidth, 0)

'The rest of vertical lines
For intContor = 0 To intNrControale - 1
If Me(intContor).Section = 0 Then
If TypeOf Me(intContor) Is TextBox And Me(intContor).Visible = True Then
Me.Line (Me(intContor).Left + Me(intContor).Width, 0)-Step(0, intMaxInalt)
End If
End If
Next intContor

End Sub


Make sure to take out any lines and also take borders off of your text boxes...and make them transparent.

Hope this helps.
-Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top