Problem with having all textboxes of a record the same height

Laftrip

Registered User.
Local time
Today, 04:02
Joined
Apr 23, 2004
Messages
23
I am printing a report where it needs to look like a report that already exist. I can have the report look like a spreadsheet, that is not a problem.

Here is the problem:

One of the fields is textbox which I have set to "can grow" because I don't want to cut off the information, but this causes this textbox to grow taller and the other textboxes of that record remain the same size, causing an ugly looking report.

Is there a way in vba, or another way, that I can make the other textboxes grow if that particuliar textbox grows?
 
I can't give you the exact code but in the report's Format event, you would look at the hight of the control that can grow and set the hight of each other control to that height.
 
Pat Hartman said:
I can't give you the exact code but in the report's Format event, you would look at the hight of the control that can grow and set the hight of each other control to that height.

I've tried doing this with a Macro and with VBA with no success. With the VB code, I can assign a value to the height of a textbox manually, say 1000, and I see that box becomes bigger. But when I try to assign the value of the textbox's height (the one that can grow), nothing changes.

Should the code (or macro) go in the format event of the details of the report? And does it matter if this form is actually a subreport of another report? Need more info... or even a line of two of code...

Is there another thread which deals with changing textbox heights like this?
 
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim CtlDetail As Control
Dim intLineMargin As Integer


intLineMargin = 60


For Each CtlDetail In Me.Section(acDetail).Controls
With CtlDetail

Me.Line ((.left + .Width + intLineMargin), 0)-(.left + .Width + _
intLineMargin, Me.Height)

End With
Next
With Me
Me.Line (0, 0)-Step(.Width, .Height), 0, B
End With

Set CtlDetail = Nothing

End Sub
 
Ok, it seemed to work fine at first, but it's creating all sorts of problems now that I have applied this to my headers and other subreports...

I liked that first idea, and I see where the problem with that solution was. The On Format event is described as executed Before the section is formatted. Well, before the section is formatted, the textbox that grows is still at it's default value.

Where could I implement that same code so that it executes after the section was formatted?

Note: I tried it in on print, but I get an error saying that it's too late to modify those values at that time... it must be done before the preview.
 
Actually Rich, I found a way to make you solution work...

Now I'm focused on printing a fake "NONE" record if no records are found in a subreport... see my other post for a challenge and lots of fun!
 

Users who are viewing this thread

Back
Top Bottom