Bold Format Only Part of a Text Box Control

G

Guest

I have this as a control on one of my reports.

=RTrim([PART]) & " [ " & RTrim([Description]) & " ]"

It is two fields, concatenated together with right trim so that they
flow/slide together nicely. Is there a way to specify just the [PART] field
to print in BOLD or is there another way to get text boxes to slide together
without using concatenation??

Thanks for your help!
 
D

Duane Hookom

You can use the Print method of the report in the On Format event. For
instance if you were reporting the Customer table from Northwind and wanted
to concatenate the CustomerID and CompanyName with the first part bolded you
could use the following code in the On Format event of the section
containing the text. NOTE: the CustomerID and CompanyName would need to be
bound to controls in that report section. The controls could/should be
invisilbe.

My code also assume you add an invisible line named "LineTop" where you want
the text to appear.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim intSpacing As Integer
intSpacing = 60 'space between fields
Me.CurrentX = Me.LineTop.Left
Me.CurrentY = Me.LineTop.Top
Me.FontSize = 10
Me.FontBold = True
Me.Print Me.CustomerID 'must be bound control
Me.FontBold = False
Me.CurrentY = Me.LineTop.Top
Me.CurrentX = Me.CurrentX + intSpacing
Me.Print Me.CompanyName 'must be bound control
End Sub
 
G

Guest

NEAT TRICK! Works like a charm! Thank you


Duane Hookom said:
You can use the Print method of the report in the On Format event. For
instance if you were reporting the Customer table from Northwind and wanted
to concatenate the CustomerID and CompanyName with the first part bolded you
could use the following code in the On Format event of the section
containing the text. NOTE: the CustomerID and CompanyName would need to be
bound to controls in that report section. The controls could/should be
invisilbe.

My code also assume you add an invisible line named "LineTop" where you want
the text to appear.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim intSpacing As Integer
intSpacing = 60 'space between fields
Me.CurrentX = Me.LineTop.Left
Me.CurrentY = Me.LineTop.Top
Me.FontSize = 10
Me.FontBold = True
Me.Print Me.CustomerID 'must be bound control
Me.FontBold = False
Me.CurrentY = Me.LineTop.Top
Me.CurrentX = Me.CurrentX + intSpacing
Me.Print Me.CompanyName 'must be bound control
End Sub


--
Duane Hookom
MS Access MVP

laknight said:
I have this as a control on one of my reports.

=RTrim([PART]) & " [ " & RTrim([Description]) & " ]"

It is two fields, concatenated together with right trim so that they
flow/slide together nicely. Is there a way to specify just the [PART]
field
to print in BOLD or is there another way to get text boxes to slide
together
without using concatenation??

Thanks for your help!
 

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

Top