?
Solved

Grow label height with text box height in Access report

Posted on 2008-10-30
10
Medium Priority
?
2,143 Views
Last Modified: 2013-11-28
Hi

I have a report with text boxes that have the property "Can Grow" set to "Yes".  Thus, when the control source is a long memo string, the text box height increases to accomodate all of its contents.

However, I cannot find a way of making the height of the associated label increase accordingly.  This affects the presentation of the report.

Thank you.
0
Comment
Question by:ntahall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22844360
ntahall,

You cannot do this easily.

The reason is because the assumption is that the lable needs to be "Near" the textbox, it does not really have to be the same size as the textbox.
For example, If the field is a desciption and it is 1000 charchters long and the textbox grows to 3 inches tall, the label that simply says "Description", does not really need to be 3 inches tall as well.

That being said ... If you put a solid border around the label, sometimes this is needed.

However, the size that the textbox grows is not really exposed to VBA.
For example if you do this:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    MsgBox Me.PlotSummary.Height
End Sub

The height will be thae same for all the records, but the actual textbox height will vary.

You can try this page:
http://www.lebans.com/Report.htm

Perhaps something there might help you.

JeffCoachman
0
 

Author Comment

by:ntahall
ID: 23027802
Hi Jeff

Apologies for the delay in getting back to you, we've been busy with something else.

One of my colleagues has tried your suggestion but was unable to get it to work.

I've also had a look at http://www.lebans.com/Report.htm but was unable to find something that would to the trick.  Is there are one of their utilities that you'd recommend for this problem?

Kind regards
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 23033358
ntahall,

Then use a textbox instead of a Label.

Set the Textbox ControlSource to whatever the Label caption was.

So if the Label caption was:   c98f33wrfliwehtfkurhfgihifhcicierfnierwie

Set the new Textbox ControlSource to: ="c98f33wrfliwehtfkurhfgihifhcicierfnierwie"

Then set the Cangrow Property of this new textBox to: Yes

JeffCoachman
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:ntahall
ID: 23077848
Hi Jeff
Thanks for that.  Will the textbox then grow with the adjacent one or will some code be required?
Nick
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 23079883
ntahall,

The textbox will grow to the height that will display all the text within it.
It cannot be set to "grow" the same amount as another control.

Besides, the "Height" of textboxes when it Grows, really does not change as far as VBA is concerned.

What effect are you trying to achieve with this system?

JeffCoachman
0
 

Author Comment

by:ntahall
ID: 23138218
Hi Jeff

Yes it will as I'm trying to display the label and control as a row in a table, with the background colour dependent on the risk score.

This works fine as long as everything has only 1 line of text, but as soon as it's a bigger it makes the report look awkward.

Kind regards
Nick
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 1200 total points
ID: 23141072
ntahall,

There is no easy way around this because there is no property that allows Labels to Grow to the same height as the associated textbox.

You can see this link, perhaps you can use one of the technique for a possible workaround.
http://www.lebans.com/Report.htm

Another option:
Make the textbox and the Lable the same width.
Copy the textbox and set the text color (ForeColor) the same as the Back Color.
Put the textbox on the lable so that it covers it entriely.
Use the Format menu to "Send it to Back"

This will make the textbox grow"Behind" the label, acheiving the effect you are looking for.

Here is a screenshot
;-)

JeffCoachman
untitled.JPG
0
 
LVL 10

Assisted Solution

by:calpurnia
calpurnia earned 300 total points
ID: 23147357
Hi ntahall, seeing Jeff's suggestion above has made me think of  a slight variation on his idea - if you're not bothered about having a gap between the label and the control, you could set the Left Margin property of the control to a suitable value, and then place the label on top of the control.

By the way, Jeff - are you going to give us the answers to the 'Guess the name of the movie from the plot summary' quiz above?


0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 23148613
calpurnia,

"By the way, Jeff - are you going to give us the answers to the 'Guess the name of the movie from the plot summary' quiz above?"

LOL!

This is an OLD Access database table, that the training company I used to work for used.
If you open up many of my "Samples", you will see that I use it over and over again.
;-)
Jeff

BTW, for the record, here are the titles:
untitled.JPG
0
 

Author Closing Comment

by:ntahall
ID: 31511669
Thanks for this.  The combination of solutions works, although I could have done with the gap between the label and the control.
Kind regards
Nick
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question