Setting Report Width In Code

webbmatt

New member
Local time
Today, 06:16
Joined
Nov 21, 2005
Messages
7
Hello,

I've built a report based on a crosstab query that may display anything upto 21 columns. A landscape A4 page will display 15 nicely, anything more than that and the report will have to be 2 pages wide. I have a lot of code in the OnOpen event which moves controls around and hides/shows them as required etc.

I've set the page width to be exactly the width of a page (so if the report has <=15 columns thaen everything displays fine - all on a single page.

When there are more than 15 columns to display I'm trying to increase the width of the report and position the desired controls in the additional space - so the report will then be 2 pages wide. I have something similar to this in the OnOpen event of my report:

...
ElseIf intStage16 = 0 Then
Me.Width = Me.Width + 998
Me.txtStage16.Left = Me.Width - 998

End If
...

This basically says, if there is no stage 16 then increase the width of the report and position stage16 in the additional space. In the case of this report, if there is no stage16 then the control will hold a total - incase it sounds a bit odd to anyone that I want to display it when it holds no data.

By using Debug.Print Me.Width and Me.txtStage16.Left I can see the controls have been positioned where I want them. I can even see a little bit of one of them on the first page of the report. So I'm guessing this bit has worked Ok.

The problem is that the report preview is still only one page wide. So although the report is wider than the printable area it doesn't let me see the second page.

Can anyone shed any light on this please as it's driving me crazy!

Should I not be increasing the width of the report in the OnOpen event?

Many thanks in advance...
 

Users who are viewing this thread

Back
Top Bottom