|
-
Jun 11th, 2007, 09:15 AM
#1
Thread Starter
Addicted Member
[VBA] Change size of label
Hello,
I have an Access report. At the "onFormat" event I want to change the "height" of an element.
There is a line around this element (a box), so I check for the change of size.
So I tried:
Me.myElement.Height = 5
And this does work. I get a line (i don't even see the data).
But when I actually try to make the height very large for example 50, the maximum the box will grow on is whather space the text take.
How can I fix that ? Is there something I am doing wrong ?
The reason why I am trying to do this:
I have different info in my report
For example:
Info 1, Info 2, Info 3... and so on
When I generate my report each one of them is surrouned by a box (ie, border = solid).
Info 3 is a bit like a memo.
My problem right now is that the box around info 1 is not equal to the box around info 2 or info 3... I want to have all the boxes size to be equal to the largest.
So that's why I have to know how to set the height programatically so that when the report is generated it sets the heigh of the boxes to the height of the "tallest" box.
But if you have a way around let me know please !
thanks !
>>>>> UPDATE :
I fixed part of my problem.
I disabled the "Can grow" and "Can Shrink"
My issue now is for EACH detail i want to find the tallest size ( i know how to do that), but I don't know how in the "OnFormat" event do it for EACH detail in the report... right now it does it for everything... all the details box are the same....
please help,
thanks
>>>>> MORE UPDATE :
I did figure out to force the size of the fields. (the cangrow and canshrink have to be set to false)
My problem is that I want all the fiels to be the same size as the field with the tallest size.
The fields (Memo, and Description) are the tallest one no matter what.
So I want to do a check to see which one of the two is the tallest and then set the size of everything else equal to the tallest.
So right now I have in the OnFormat event:
If Me.Memo.Height > Me.Description.Height Then
Me.Field1.Height = Me.Memo.Height
Me.Field2.Height = Me.Memo.Height
Me.Field3.Height = Me.Memo.Height
Me.Field4.Height = Me.Memo.Height
Me.Field5.Height = Me.Memo.Height
Me.Field6.Height = Me.Memo.Height
Else
Me.Field1.Height = Me.Description.Height
Me.Field2.Height = Me.Description.Height
Me.Field3.Height = Me.Description.Height
Me.Field4.Height = Me.Description.Height
Me.Field5.Height = Me.Description.Height
Me.Field6.Height = Me.Description.Height
End If
PROBLEMS:
Right now this does not work.
BUT if I give a number instead of "Me.Descriptionm.Height" or Me.Memo.Height
Everything works properly.
I think it's because I have to write the code in a way so that it's applied to each "detail" iteration. I am not sure how.
The other problem is that the Memo and Description field are both set to "Cangrow" yes.
So that I know big they get.
Let's say Memo is bigger than description. I will want to set Description at the same size as Memo.
But I can't, because "Cangrow" is set as yes. And it does not look like I can change this setting from VBA...
Please help, it's a bit hard to understand, but I have been stuck for a long time on this one.
I am doing all of this to have all the solid lines around the fields sized the same. Because if I enable the cangrow option, i will a nice box around each field, but each one of them is different size... so it's looks a bit weird for a "table" type report.
Thanks for your help
Last edited by Zoroxeus; Jun 11th, 2007 at 10:52 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|