472,119 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Report Text Box Height - Always the same height as the detail section

Hi,

I'd like to produce a report that basically looks like an excel printout.

Description:
Profile Print Report
Detail Section with 3 bordered text boxes
all text boxes are 'abutted' against each other (where one ends, the next begins)
all text boxes have the 'can grow' property set to yes.
Detail Section with 'can grown' = yes

Desire:
allow that all 3 cells grow equally.

However, I would like the bordered cells to always be of the same height.

Basically, if one text box is taller than the other 2, the other two have adequate whitespace inside the textbox to cause all 3 to be of equal height.

What event of the detail section can I use so that either all 3 text boxes end up as tall as the detail section or each text box height = the height of the tallest text box after it has 'grown'?

Thanks!
Sep 20 '07 #1
7 13069
Jim Doherty
897 Expert 512MB
Hi,

I'd like to produce a report that basically looks like an excel printout.

Description:
Profile Print Report
Detail Section with 3 bordered text boxes
all text boxes are 'abutted' against each other (where one ends, the next begins)
all text boxes have the 'can grow' property set to yes.
Detail Section with 'can grown' = yes

Desire:
allow that all 3 cells grow equally.

However, I would like the bordered cells to always be of the same height.

Basically, if one text box is taller than the other 2, the other two have adequate whitespace inside the textbox to cause all 3 to be of equal height.

What event of the detail section can I use so that either all 3 text boxes end up as tall as the detail section or each text box height = the height of the tallest text box after it has 'grown'?

Thanks!
Have look at the LINE method in an Access Report to draw a rectangle around each of the text boxes. (examine the arguments that constitute that method, particularly the last argument if you wish to fill the rectangle with a specific colouring)

By looping through the controls you intend to work with ie: referenced in an zero based array you could thus draw a rectangle around each one commensurate with the height of the 'tallest' textbox control referenced.

This would then give the 'appearance' of each textbox having the same height with borders in effect 'drawn' at runtime. (you could set the actual border color property of each control itself to the same as the detail section)

If as you say the textboxes are butted up to each other arranged left to right in the detail section of the report with the controls set to grow, then try the following in the ON PRINT property of the detail section. (I,ll leave you to deal with your own error handling)

Expand|Select|Wrap|Line Numbers
  1. On Error Resume Next 
  2. Dim lngCounter As Long, dblMaxHeight As Double 
  3. dblMaxHeight = 0 
  4. ReDim strcontrol(3) 
  5. strcontrol(0) = "TheNameOfYourTextBoxOne
  6. strcontrol(1) = "TheNameOfYourTextBoxTwo
  7. strcontrol(2) = "TheNameOfYourTextBoxThree
  8. For lngCounter = 0 To UBound(strcontrol) 
  9. If Me(strcontrol(lngCounter)).Height > dblMaxHeight Then dblMaxHeight = Me(strcontrol(lngCounter)).Height 
  10. Next 
  11. For lngCounter = 0 To UBound(strcontrol) 
  12. If lngCounter = 0 Then 
  13. Me.Line (Me(strcontrol(lngCounter)).Left, Me(strcontrol(lngCounter)).Top)-Step(Me(strcontrol(lngCounter)).Width, dblMaxHeight), , B 
  14. Else 
  15. Me.Line (Me(strcontrol(lngCounter)).Left, Me(strcontrol(lngCounter)).Top)-Step(Me(strcontrol(lngCounter)).Width, dblMaxHeight), , B 
  16. End If 
  17. Next
  18.  
Hope this helps you

Regards

Jim
Sep 21 '07 #2
Jim,

Sorry for the late reply! I have introduced your code and it is near perfect on the first effort! I think I have something in my on print event or the properties of the text boxes that are causing some issues. I will address those and I believe this approach can give me exactly what I need.

Thank you so much and again my apologizes for the late response... I've been away from this project for some weeks.
Oct 6 '07 #3
Jim Doherty
897 Expert 512MB
Jim,

Sorry for the late reply! I have introduced your code and it is near perfect on the first effort! I think I have something in my on print event or the properties of the text boxes that are causing some issues. I will address those and I believe this approach can give me exactly what I need.

Thank you so much and again my apologizes for the late response... I've been away from this project for some weeks.
Glad it helps you. The line method is an appropriate use in reports in your case as a workaround because Access will throw an error if you try to resize a textbox 'in itself' once printing commences using the on format or on print events.

Regards

Jim
Oct 7 '07 #4
This code should do exactly what I am needing for a report I am working on as well. However, I am running into an odd problem. It is acting like the code is grabbing the control height before the can grow property runs. All of the lines are being drawn, but they are drawn to the size of the original text boxes (in the design view), not to the size of the text boxes after the can grow property. Any thoughts?
Jan 20 '08 #5
Jim Doherty
897 Expert 512MB
This code should do exactly what I am needing for a report I am working on as well. However, I am running into an odd problem. It is acting like the code is grabbing the control height before the can grow property runs. All of the lines are being drawn, but they are drawn to the size of the original text boxes (in the design view), not to the size of the text boxes after the can grow property. Any thoughts?
I've never had that issue myself, make sure you have no overlapping controls and that they sit horizontally side by side and that you are using this is the on print property. The 'growing' should be taking place before the on print with the lines drawn to the 'tallest' textbox one in any group

Jim :)
Jan 21 '08 #6
ramies
2
i never expect that it would be so difficult to draw lines on the report. tremendous to understand. unusual programmer . what i had in mind to do is to make spaces on every record. make a new table and fill them all with same amount of data for every record line.
Feb 22 '08 #7
ramies
2
i need to study the code that you presented. anyway thank you
Feb 22 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.