Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Space between lines in MS Access Report

I need to reduce space between lines in a custom paper size report that I need to create for a label.

My report custom paper size is 5.75 Inch x 1.75 Inch and the filed is

Font Name: Times New Roman
Font Size: 6
Can Grow: Yes
Can shrink: Yes

Section Detail Height: 0.0833" -- Reducing this value dose not reduce the space between lines

I tried VBA Private Sub Report_Open(Cancel As Integer)

Me.Detail.Height = 3

and
rpt.Section(acDetail).Height = 10

but could not reduce the space between lines.

When I open the report I can see that there is space between lines that can be reduce ( I just need a hair line space between two lines)

Dose any one know how to fix this problem

Thanks
Rahul
[799 byte] By [rpatil] at [2007-11-11 9:56:55]
# 1 Re: Space between lines in MS Access Report
Line height is basically controlled by the font. If you are trying to reduce the line spacing within a multi line control then there is no easy way except by choosing a different font. Now if you mean the spacing between each line of deatil in your report. That is controlled by the height of the controls within the detail section as well as the size of the detail area itself. If you move all of the controls so that their Top property is set to zero, aligning them all to the top of the detail area, and then shrink the detail area by dragging the bottom all the way to the bottom of the controls. This will reduce the spacing between each line of detail. If you shrink the height of the controls as well the you can reduce the spacing even more; but if you shrink the height too much then the characters will start getting cut off. Experimentation works best at this point.
Ron Weller at 2007-11-11 23:43:35 >
# 2 Re: Space between lines in MS Access Report
I have set height of all fields in report to 0.09" this is the height I want so that there is no extra space between lines -- The report looks fine with exact line spacing how I want ( with Can Grow: No)

BUT when I change the CAN GROW property of all fields to: YES it adds the extra space between the lines that I do not want.

I have tried to reduce the space between the lines by VBA code

VBA Private Sub Report_Open(Cancel As Integer)

Me.Detail.Height = 30
rpt.Section(acDetail).Height = 30

but this dose not have any effect on space between line it can increase space between line if I set height to more than 150 but below 150 it dose not reduce the line space.

It has to do some thing with CAN GROW: YES properties

Can anyone suggest me how can I fix this problem
rpatil at 2007-11-11 23:44:29 >
# 3 Re: Space between lines in MS Access Report
By changing the Can Grow property of your controls to true, you are telling access it is ok to resize the controls to fit the data. The only way access can do this is by calculating how many lines of data times the amount of space a single line takes up. As far as access is concerned the space a single line of data takes up is based one the Font Metrics. Because CanGrow was turned off you could overide the line spacing; but now that CanGrow is on access resizes the control in increments of a single line. So you lose the ability to size a control smaller than the size of a single line. Check the properties of each control, there should be a Line Spacing property. It shows the line spacing in inches and is usually set to 0", try changing this value to the same as the height of the control. Maybe access will use it in its line height calculations, rather than the font's line height. One last thing when you change the controls size, Height and Width properites, using code the values are not in Inches they are in Twips. You would have to do a conversion to get the code to work the way you think it would. In the properties dialog the sizes are in inches and access does the conversion for you; but in code it is always in Twips.
Ron Weller at 2007-11-11 23:45:36 >
# 4 Re: Space between lines in MS Access Report
Is there a way to give conditional cangrow for example if the number of characters in a filed is greater than say 100 it can grow else do not grow.

I am trying to fit 31 to 37 lines in my custom paper size report , and my data structure is such that for all structure type only the first record is greater than 150 and all remaining are below 100 characters.

So it will be ideal if the cangrow property work only for first row and after that the remaining row need not expand/grow.

This will give the result that I want but I am not able to set cangrow property to yes based on a criteria ,

Is this Possible ??

Thanks
Rahul
rpatil at 2007-11-11 23:46:35 >
# 5 Re: Space between lines in MS Access Report
No, CanGrow is a design mode only property. :(
Ron Weller at 2007-11-11 23:47:34 >