Bolding labels on a report (1 Viewer)

JC10001

Registered User.
Local time
Today, 17:24
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:

WayneRyan

AWF VIP
Local time
Today, 17:24
Joined
Nov 19, 2002
Messages
7,122
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
 

JC10001

Registered User.
Local time
Today, 17:24
Joined
Sep 24, 2003
Messages
48
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?
 

john471

Registered User.
Local time
Tomorrow, 02:24
Joined
Sep 10, 2004
Messages
392
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
 

WayneRyan

AWF VIP
Local time
Today, 17:24
Joined
Nov 19, 2002
Messages
7,122
jc,

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

Wayne
 

john471

Registered User.
Local time
Tomorrow, 02:24
Joined
Sep 10, 2004
Messages
392
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 :(
 

WayneRyan

AWF VIP
Local time
Today, 17:24
Joined
Nov 19, 2002
Messages
7,122
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
 

JC10001

Registered User.
Local time
Today, 17:24
Joined
Sep 24, 2003
Messages
48
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

Top Bottom