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.
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.
What you need to do is create a couple of module level variables to hold the dimensions of the label. Then check it against the current label in the detail section. If the label is larger then increase the var size but if its not then use the var size for the dimensions of the label. Only issue will be previously formatted lables will not update to any newly increased sizes.
Can you post a small screen shot of your report and a before and after look of how you need it?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
I am attaching you the picture.
I am not sure what you meant by the multiple module thing.
But the picture is pretty clear.
I asked on an Access forum, and they had no idea... so it may be a bit challenging.
I am a bit new to that whole access report thing... i always managed to get things done... but this time it's a bit of a trouble wrt the way i want my report...
thanks for help
Instead of using the label border outlining just draw lines and position the horizontal leveling at the bottom of the tallest label for that detail record and adjust the length of the vertical lines so they are all the same lengths.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
(it's a monlet test, so there is no comparisons between the two fields and all that)
Line31 is the horizontal line and this works fine it goes as low as the line from description.
Line39, 40, 41... are the vertical lines. This does not seem to work.... ? They stay at the same size
I did a message box, for the value of Report_a.Descri.Height
it stays the same at for every single detail. So that's the problem.
getting there....
thanks !
Last edited by Zoroxeus; Jun 12th, 2007 at 08:19 AM.
Reason: fixed typos
Ok, for the height dont use the detail height but eval each label to see which is the tallest and then use that value to adjust the vertical line lengths of all in that section.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
RobDog,
I am not sure what you mean by "eval each label" to see which is the tallest.
What would it change ?
And also ONLY "description" and "memo" get bigger than everything else.
But again, why this way would not work ?
thanks
Does not seem to work...
It is strange because the two vertical lines at the extremities are taller than the rest... but still they don't reach to the horizontal line
I think it is the whole "if" thing that is posing problem.
At the format event I have:
[Report_Generic Report].Line31.Top = [Report_Generic Report].Descri.Height
This is the horizontal line, and it works perfect.
Then I have
If [Report_Generic Report].Descri.Height >= [Report_Generic Report].Remarks.Height Then
[Report_Generic Report].Line47.Height = [Report_Generic Report].Descri.Height
else
end if
and this does not seem to work.
It makes my original line smaller.
--
There seems to be something wrong with my code.
I don't think "height" of a label is the same as "height" of line.
When i ask to display height of label it gives me "270" ... ??
When height is like 5.3 cm for example
Last edited by Zoroxeus; Jun 13th, 2007 at 08:42 AM.
I attached the db file...
thanks if you can take a look at it....
It does not matter what I do... the number I get is always "270" ....
(mdb file is renamed as zip)