gillianleec
Technical User
I have a report that prints for a location and has a subreport that prints the people associated with that location in columns. I have written code into the subreport that changes the fontsize depending on the recordcount in the subreport. I would also like to change the number of columns and column width in the subreport based on record count. I can do this with a printer object in the report design but am not allowed to use a printer object with a subreport. Does anybody have any suggestions on another way to handle this?
Here is my code for the subreport formatting:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim vardocname As Variant
vardocname = Me.txtdocname
Select Case Me.txtCountRec
Case Is > 4
With Me.Printer
.ItemsAcross = 2
.RowSpacing = 0
.ColumnSpacing = 0
.ItemSizeWidth = TextWidth(vardocname)
.ColumnSpacing = 0.2 * 1440
End With
Me.txtdocname.FontSize = 6
Me.txtdocname.Width = TextWidth(vardocname)
Case Is <= 4
With Me.Printer
.ItemSizeWidth = 5000
End With
Me.txtdocname.FontSize = 9
Me.txtdocname.Width = TextWidth(vardocname) + 175
End Select
End Sub
The error I get when I try to run this as a subreport is:
Printer object is not available on subforms and subreports.
Here is my code for the subreport formatting:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim vardocname As Variant
vardocname = Me.txtdocname
Select Case Me.txtCountRec
Case Is > 4
With Me.Printer
.ItemsAcross = 2
.RowSpacing = 0
.ColumnSpacing = 0
.ItemSizeWidth = TextWidth(vardocname)
.ColumnSpacing = 0.2 * 1440
End With
Me.txtdocname.FontSize = 6
Me.txtdocname.Width = TextWidth(vardocname)
Case Is <= 4
With Me.Printer
.ItemSizeWidth = 5000
End With
Me.txtdocname.FontSize = 9
Me.txtdocname.Width = TextWidth(vardocname) + 175
End Select
End Sub
The error I get when I try to run this as a subreport is:
Printer object is not available on subforms and subreports.