Report width can grow

  • Thread starter Thread starter Vensia
  • Start date Start date
V

Vensia

Dear all,

I have a report which contains several dynamic columns. I want the report
width can grow following the columns which will be displayed. How I write
the code ?
Thanks for helping.
 
There seems to be a limit to the width of a report. Why don't you use the
widest possible report and then hide or show columns.

If you provided a little more information, maybe someone could provide a
better solution.
 
If I use the widest possible report, the problem is when the user just
display 1 or 2 columns, then the user can not set up a bigger left margin to
make the report printed at the middle of paper. If the user set up a bigger
margin, then the report will be printed in two pages rather than one pages.
Below is the illustration of my report :
- The report has 10 columns.
- There are 10 text box which has the same propeties (in design mode
properties : left = 0 and width = 1 inch)
- In design mode, the report width is 1 inch.
- If the user want to display 3 columns, then
text box 1 : left 0
text box 2 : left 1440 (twips)
text box 3 : left 2880 (twips)
report width will be changed from 1 inch to 3 inch.

Thanks.
 
I missed the "make the report printed at the middle of paper" in your first
posting.

You can use code to determine the number of fields/columns in your report's
record source in the On Open event of the report. Then set the left
properties based on the number of columns.

Are you looking for someone to write the code for you?
 
Yes, I want to know how to write the code about setting the report width and
setting the text box left properties.

The simple illustration of my report problem is like this :
- Design mode
Report width : 1 inch, widest possible : 7 inch
There are 7 text box (all text box left: 0, width : 1 inch)
In preview mode, if user want to display 3 columns :
- text box 1 left 0
- text box 2 left 1 inch
- text box 3 left 2 inch
- text box 4 until text box 7 visible=false
So the report only needs width 3 inch and user can set margin left to 2.5
inch to make the report preview seemed center (paper size 8.5 inch x 11
inch).

I have tried to write simple code like this :

Private Sub Report_Open(Cancel As Integer)
'using twips
me.width = 4320
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
me.txtField1.left=0
me.txtField2.left=1440
me.txtField3.left=2880
End Sub

After I preview the report, txtField2 and txtField3 are not seen.
I also try to write the code like this and the problem is same (txtField2
and txtField3 are not seen)

Private Sub Report_Open(Cancel As Integer)
'using twips
me.width = 4320
me.txtField1.left=0
me.txtField2.left=1440
me.txtField3.left=2880
End Sub


Thanks.
 
I would not get hung up on setting the report width. Besides this would be
very difficult. Just determine the number of fields and then set the Left
property of your text boxes as a specific number of twips so that they are
centered.
 
Back
Top