Hank wrote in message
<1145796239.175723.261650@i39g2000cwa.googlegroups .com> :[color=blue]
> My boss wants the font on reports to be user selectable on a
> Configuration screen. I open the Font Dialog and one is selected.
> When the report opens, I call a funtion that changes the font of all
> Text Boxes and Labels. I need to go through the collection of each
> section of the report: Report Header, Report Footer, Page Header, et
> cetera. I use this code:
> '
> ************************************************** *****************************
> ' Set the Report Font based on the passed information 04/23/06
> Public Sub SetReportFont(Calling As Report, PassedFontName As String)
> On Error GoTo ErrorReport
>
> Dim ctl As Control
> Dim ThisType As Long
> Dim SectionMode As Integer
>
> For Each ctl In Calling.ReportHeader.Controls
> ThisType = ctl.ControlType
> If ((ThisType = acTextBox) Or (ThisType = acLabel)) Then
> ctl.FontName = PassedFontName
> End If
> Next
>
> For Each ctl In Calling.ReportFooter.Controls
> ThisType = ctl.ControlType
> If ((ThisType = acTextBox) Or (ThisType = acLabel)) Then
> ctl.FontName = PassedFontName
> End If
> Next
> And so on. The problem is that some reports may not have a page
> header or footer or some other section. Is there a way that I can
> tell if the passed report has a particular section before I try to
> loop through its collection? I'm using Access 2000.
> Thanks,
> Hank Reed[/color]
I am not sure at all, but I don't think this is exposed. (I'd love to
be
proven wrong on that). I think I'd try brute force, as in for instance
on error resume next
debug.print calling.section(acPageHeader).controls.count
if err.number <> 0 then
' probably doesn't exist
err.clear
else
' loop the controls
end if
But I'd advice to be carefull when referring to the report sections.
See the following thread for why (watch for linebreaks in the link)
http://groups.google.com/group/comp....018f1b65acea7e
--
Roy-Vidar