Formatting Data

  • Thread starter Thread starter appbeg
  • Start date Start date
A

appbeg

I am trying to replicate a report to look just like a current document my
office currently uses. Through a series of update queries I create the data
and write it line by line to my report file (each record corresponds to a
line on the report). Is there a way that I can "hardcode" format information
into the data when I build the table so that when it prints it prints in the
proper format. Since each record represents a different line and could
require different formatting. Ex. 1 record contains column headings for a
section of the report "Campus Direct Consult Total
Students", this would be Bold and a larger font. The series of lines that
follow would require the first part of the line to be bold, but the remainder
a normal font. Bottom line, instead of formatting the Detail section in the
report can I somehow format the data in the table.
 
Well you could add two fields to the table to record the font size and font
format.

Then whem you build a record you can specify the font attributes for that line.

In the format event the section (detail section?) of the report you would have
to test the value in the two fields (you have to have them in the report, but
they don't have to be visible).

Based on the values, you would loop through the controls in the section and
set the font size and font weight properties.

The code might look like the following UNTESTED VBA

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim ctl As Control

For Each ctl In Me.Section(acDetail)
Select Case ctl.ControlType
Case acLabel, acTextBox
ctl.FontSize = Nz([fldFontSize], 10)
If [fldFondWeight] = "Bold" Then
ctl.FontWeight = 700
Else
ctl.FontWeight = 500
End If
End Select
Next ctl
End Sub

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top