setting font properties with print method

  • Thread starter Thread starter francvs
  • Start date Start date
F

francvs

Hi all,
is there any way to print a string with different font weights/styles
in a detail_format (or detail_print) function?
Let's clear my problem a bit more: I am writing a report which should
display records from a query in different ways, depending on the value
of a particular field. Moreover, the report should sweep away the
(frequent) empty fields it encounters on its road.
What i did so far is to make the fields invisible from the design view,
and then build a properly formatted string from the
Me.fieldname.values.
But this prevents me from setting the fonts the way I want, except for
the whole report. Can't I "set" the properties of a single piece of
string?
Any idea? Thanks in advance.

this is my code:

Private Sub Corpo_Format(Cancel As Integer, FormatCount As Integer)
Dim rpt As Report
Dim strMyRecord As Variant

Set rpt = Me

With rpt
.ScaleMode = 3
.FontName = "Trebuchet"
.FontSize = 11
End With

rpt.CurrentX = 0
rpt.CurrentY = 0

' this is the formatting I need to do

If IsNull(Me.Specifiche_Autore.Value) Then
strMyRecord = Me.Autore.Value & ", " & Me.Titolo.Value & ". " &
_ Me.Sottotitolo.Value
ElseIf Me.Autore.Value = "AAVV" Then
strMyRecord = Me.Specifiche_Autore.Value & " (cur.), " &
Me.Titolo.Value & ". " & _
Me.Sottotitolo.Value
Else
strMyRecord = Me.Autore.Value & " (cur.), " & Me.Titolo.Value &
". " & _ Me.Sottotitolo.Value & _
vbNewLine & "Altri aut.:" & Me.Specifiche_Autore.Value
End If

rpt.Print strMyRecord
End Sub
 
Each Print statement uses the property settings in effect
when it executes. If you want to Print using different
properties, then print each piece separately.

If IsNull(Me.Specifiche_Autore.Value) Then
Me.FontBold = True
Me.FontItalic = False
Me.ForeColor = vbRed
Print Me.Autore.Value & ", ";
Me.FontBold = False
Me.FontItalic = False
Me.ForeColor = vbBlue
Print Me.Titolo.Value & ". ";
Me.FontBold = True
Me.FontItalic = True
Me.ForeColor = vbGreen
Print Me.Sottotitolo.Value
Else
. . .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top