Bolding labels on a report

JC10001

Registered User.
Local time
Today, 17:16
Joined
Sep 24, 2003
Messages
48
I have some labels on a report.

I would like to bold some of these labels inside of the Report_Open event if certain records that correspond to the lables contain a specific value.

How would I go about doing this? I know how to open a recordset. My question is, what is the VB code to change the weight of a font for a label?
 
Last edited:
JC,

If you have A2000 or greater, look at Conditional Formatting.

Otherwise, you'll have to use the DetailFormat event and:

Me.SomeControl.FontBold

Wayne
 
Thanks Wayne.

I ended up having to place the code in the DetailFormat event.

But I'm still having a problem. A list of classes is being generated for each student which is what I want... but the bolding is the same for all of the students.

So if student1 took algebra only and student2 took biology only then both algebra and biology are getting bolded on both student's reports. It should be just algebra on student1 and just biology on student2. Is there anyway to make it unique for each student?
 
I suffered a similar problem. I think I read somewhere in this forum... perhaps another... the way to achieve this (at least in AC97) is to create two labels for each item, one bold weight, and the other normal. Place them on top of each other. Then show/hide as appropriate using the Details OnFormat event.

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If [biology] = true Then
        Me.lblBiologyBold.Visible = True
        Me.lblBiologyNormal.Visible = False
    Else
        Me.lblBiologyBold.Visible = False
        Me.lblBiologyNormal.Visible = True
    End If
End Sub

HTH

Regards

John
 
jc,

Code:
If SomeCondition Then
   Me.Label.FontBold = True
Else
   Me.Label.FontBold = False
End If

Wayne
 
Wayne,

I was playing around with it and what you've got (immediateley above) does work for me. Hope JC finds same success!

In the reports detail section's onFormat event...

If SomeCondition Then
Me.Label.FontBold = True
Else
Me.Label.FontBold = False
End If

Which leads me to wonder what was the problem I was needing to solve (in AC97) that required me to place multiples of similar items... perhaps it was in a form... ahhhh my failing memory :(
 
John,

Not sure, but I think that he probably didn't use an Else. So once he
bolded one, it stayed that way. He might have assumed that it would
"reset" on each record.

Maybe he'll let us know.

Wayne
 
Wow, sorry it took so long to respond. You guys are correct, I didn't have an else statement. I thought the property would automatically reset itself for each group of records. After I used the else it worked. Thanks for all your help.
 

Users who are viewing this thread

Back
Top Bottom