Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Grow label height with text box height in Access report

Posted on 2008-10-30
10
Medium Priority
?
2,334 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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 …
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

577 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