Bolding a single word in a line of data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have a concatenated field and I only want the last name to be bolded.
Another person had this question, and I followed the path suggested by the
inimitable Stephan Lebans. I copied his code into my report though it debugs
on the first line ...

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

I'm on ACCESS 2000 - does this make a difference?

Also - what is the code for making it in CAPITALS as well?
 
I don't know if this method will work for you but you can use the Print
method of the report like:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intTop As Integer
Dim intLeft As Integer
Me.FontSize = 20
Me.FontName = "Arial"
intTop = 360 '1/4 inches
intLeft = 1440 '1 inch
Me.CurrentY = intTop
Me.CurrentX = intLeft
Me.Print "You have $"
Me.CurrentY = intTop
Me.FontBold = True
'this assumes there is a text box named _
txtDollars_Left in the detail section
If Me.txtDollars_Left < 0 Then
Me.ForeColor = vbRed
End If
Me.Print Trim(Me.txtDollars_Left)
Me.CurrentY = intTop
Me.FontBold = False
Me.ForeColor = vbBlack
Me.Print " left to spend."
End Sub
 
Hi Duane - thanks for this. When I went in again the code worked!!!. Fabbo
- though do you know what the command is for MAKING CAPITALS - Cheers
 
Any text that you want to display in upper case, use the function
UCase([YourExpression])
 
Hi Duane

I tried that in the body of the code 'where the formatting is established' -
though it didn't work. This is to make the Lastname of the concatenated
field in capitals [as well as bold] as per my previous post. Is there
something else I should be trying?

--
Sue Compelling


Duane Hookom said:
Any text that you want to display in upper case, use the function
UCase([YourExpression])
 
What did your attempt look like? Did you try something like:
Me.Print UCase(Trim(Me.txtDollars_Left))


--
Duane Hookom
MS Access MVP


Sue Compelling said:
Hi Duane

I tried that in the body of the code 'where the formatting is
established' -
though it didn't work. This is to make the Lastname of the concatenated
field in capitals [as well as bold] as per my previous post. Is there
something else I should be trying?

--
Sue Compelling


Duane Hookom said:
Any text that you want to display in upper case, use the function
UCase([YourExpression])

--
Duane Hookom
MS Access MVP


message
Hi Duane - thanks for this. When I went in again the code worked!!!.
Fabbo
- though do you know what the command is for MAKING CAPITALS - Cheers
--
Sue Compelling


:

I don't know if this method will work for you but you can use the
Print
method of the report like:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intTop As Integer
Dim intLeft As Integer
Me.FontSize = 20
Me.FontName = "Arial"
intTop = 360 '1/4 inches
intLeft = 1440 '1 inch
Me.CurrentY = intTop
Me.CurrentX = intLeft
Me.Print "You have $"
Me.CurrentY = intTop
Me.FontBold = True
'this assumes there is a text box named _
txtDollars_Left in the detail section
If Me.txtDollars_Left < 0 Then
Me.ForeColor = vbRed
End If
Me.Print Trim(Me.txtDollars_Left)
Me.CurrentY = intTop
Me.FontBold = False
Me.ForeColor = vbBlack
Me.Print " left to spend."
End Sub

--
Duane Hookom
MS Access MVP


message
Hi, I have a concatenated field and I only want the last name to be
bolded.
Another person had this question, and I followed the path suggested
by
the
inimitable Stephan Lebans. I copied his code into my report though
it
debugs
on the first line ...

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

I'm on ACCESS 2000 - does this make a difference?

Also - what is the code for making it in CAPITALS as well?
 
Hi Duane .... tried that and it printpreviewed the whole field in uppercase
[not just the last name of the concatenated field] AND it also 'superimposed'
itself over the field currently there. Any other suggestions?
--
Sue Compelling


Duane Hookom said:
What did your attempt look like? Did you try something like:
Me.Print UCase(Trim(Me.txtDollars_Left))


--
Duane Hookom
MS Access MVP


Sue Compelling said:
Hi Duane

I tried that in the body of the code 'where the formatting is
established' -
though it didn't work. This is to make the Lastname of the concatenated
field in capitals [as well as bold] as per my previous post. Is there
something else I should be trying?

--
Sue Compelling


Duane Hookom said:
Any text that you want to display in upper case, use the function
UCase([YourExpression])

--
Duane Hookom
MS Access MVP


message
Hi Duane - thanks for this. When I went in again the code worked!!!.
Fabbo
- though do you know what the command is for MAKING CAPITALS - Cheers
--
Sue Compelling


:

I don't know if this method will work for you but you can use the
Print
method of the report like:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intTop As Integer
Dim intLeft As Integer
Me.FontSize = 20
Me.FontName = "Arial"
intTop = 360 '1/4 inches
intLeft = 1440 '1 inch
Me.CurrentY = intTop
Me.CurrentX = intLeft
Me.Print "You have $"
Me.CurrentY = intTop
Me.FontBold = True
'this assumes there is a text box named _
txtDollars_Left in the detail section
If Me.txtDollars_Left < 0 Then
Me.ForeColor = vbRed
End If
Me.Print Trim(Me.txtDollars_Left)
Me.CurrentY = intTop
Me.FontBold = False
Me.ForeColor = vbBlack
Me.Print " left to spend."
End Sub

--
Duane Hookom
MS Access MVP


message
Hi, I have a concatenated field and I only want the last name to be
bolded.
Another person had this question, and I followed the path suggested
by
the
inimitable Stephan Lebans. I copied his code into my report though
it
debugs
on the first line ...

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

I'm on ACCESS 2000 - does this make a difference?

Also - what is the code for making it in CAPITALS as well?
 
My suggestion is for you to reply back with your code.

--
Duane Hookom
MS Access MVP


Sue Compelling said:
Hi Duane .... tried that and it printpreviewed the whole field in
uppercase
[not just the last name of the concatenated field] AND it also
'superimposed'
itself over the field currently there. Any other suggestions?
--
Sue Compelling


Duane Hookom said:
What did your attempt look like? Did you try something like:
Me.Print UCase(Trim(Me.txtDollars_Left))


--
Duane Hookom
MS Access MVP


message
Hi Duane

I tried that in the body of the code 'where the formatting is
established' -
though it didn't work. This is to make the Lastname of the
concatenated
field in capitals [as well as bold] as per my previous post. Is there
something else I should be trying?

--
Sue Compelling


:

Any text that you want to display in upper case, use the function
UCase([YourExpression])

--
Duane Hookom
MS Access MVP


message
Hi Duane - thanks for this. When I went in again the code
worked!!!.
Fabbo
- though do you know what the command is for MAKING CAPITALS -
Cheers
--
Sue Compelling


:

I don't know if this method will work for you but you can use the
Print
method of the report like:
Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)
Dim intTop As Integer
Dim intLeft As Integer
Me.FontSize = 20
Me.FontName = "Arial"
intTop = 360 '1/4 inches
intLeft = 1440 '1 inch
Me.CurrentY = intTop
Me.CurrentX = intLeft
Me.Print "You have $"
Me.CurrentY = intTop
Me.FontBold = True
'this assumes there is a text box named _
txtDollars_Left in the detail section
If Me.txtDollars_Left < 0 Then
Me.ForeColor = vbRed
End If
Me.Print Trim(Me.txtDollars_Left)
Me.CurrentY = intTop
Me.FontBold = False
Me.ForeColor = vbBlack
Me.Print " left to spend."
End Sub

--
Duane Hookom
MS Access MVP


message
Hi, I have a concatenated field and I only want the last name to
be
bolded.
Another person had this question, and I followed the path
suggested
by
the
inimitable Stephan Lebans. I copied his code into my report
though
it
debugs
on the first line ...

Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)

I'm on ACCESS 2000 - does this make a difference?

Also - what is the code for making it in CAPITALS as well?
 
Voici - you'll see I've kept all of Stefan's explanation and title in here as
well .....

' **START CODE
' Written by Stephen Lebans 1999
' (e-mail address removed)
' www.lebans.com

' This sample database is for a Poster named "Lady".
' She wanted to print her concatenated Control with
' one part in Bold and the rest normal.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Const TWIPS = 1
Dim strFirst As String
Dim strLast As String
Dim intPosition As Integer
Dim CtlDetail As Control
Dim intMargin As Integer

'I'll leave in Italic and Color in case you want to use these'
Dim oldFontBold As Integer
Dim oldFontItalic As Integer
Dim oldForeColor As Long
Dim oldFontName As String
Dim oldfontsize As Integer
Dim oldScaleMode As Integer

'Save current Font settings
With Me
oldFontItalic = .FontItalic
oldFontBold = .FontBold
oldForeColor = .ForeColor
oldFontName = .FontName
oldfontsize = .FontSize
oldScaleMode = .ScaleMode
End With

' Remember for this sample I am naming your control tblady. You MUST
' change the name here to match that of the actual control. Also
' I assumed the control source is exactly as you posted to the NG
' =[LastName]&", "&[FirstName]
' OK lets find your control and seperate the concatenated field.
' for each control in details control
For Each CtlDetail In Me.Section(acDetail).Controls
If CtlDetail.Name = "CombinedName" Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
strLast = Left(.Value, intPosition - 1)
strFirst = Mid(.Value, intPosition + 2)
'Debug.Print strLast
'Debug.Print strFirst

End With

With Me
'Make sure we are in Twips
.ScaleMode = TWIPS

'Grab Controls current Font settings
.FontName = CtlDetail.FontName
.FontSize = CtlDetail.FontSize

'Create desired Font settings
'for the Last Name - Bold Text
.FontBold = True
'.FontItalic = True
'.ForeColor = RGB(255, 0, 0) 'RED
.CurrentX = CtlDetail.Left
.CurrentY = CtlDetail.Top
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font-> NO Bold for FirstName
.FontBold = False
.ForeColor = RGB(0, 0, 0)
.FontItalic = False
Me.Print strFirst


'Restore Reports original Font settings
..ScaleMode = oldScaleMode
..FontBold = oldFontBold
..FontItalic = oldFontItalic
..FontName = oldFontName
..FontSize = oldfontsize
..ForeColor = oldForeColor

End With

End If
Next

' Cleanup
Set CtlDetail = Nothing
End Sub

--
Sue Compelling


Duane Hookom said:
My suggestion is for you to reply back with your code.

--
Duane Hookom
MS Access MVP


Sue Compelling said:
Hi Duane .... tried that and it printpreviewed the whole field in
uppercase
[not just the last name of the concatenated field] AND it also
'superimposed'
itself over the field currently there. Any other suggestions?
--
Sue Compelling


Duane Hookom said:
What did your attempt look like? Did you try something like:
Me.Print UCase(Trim(Me.txtDollars_Left))


--
Duane Hookom
MS Access MVP


message
Hi Duane

I tried that in the body of the code 'where the formatting is
established' -
though it didn't work. This is to make the Lastname of the
concatenated
field in capitals [as well as bold] as per my previous post. Is there
something else I should be trying?

--
Sue Compelling


:

Any text that you want to display in upper case, use the function
UCase([YourExpression])

--
Duane Hookom
MS Access MVP


message
Hi Duane - thanks for this. When I went in again the code
worked!!!.
Fabbo
- though do you know what the command is for MAKING CAPITALS -
Cheers
--
Sue Compelling


:

I don't know if this method will work for you but you can use the
Print
method of the report like:
Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)
Dim intTop As Integer
Dim intLeft As Integer
Me.FontSize = 20
Me.FontName = "Arial"
intTop = 360 '1/4 inches
intLeft = 1440 '1 inch
Me.CurrentY = intTop
Me.CurrentX = intLeft
Me.Print "You have $"
Me.CurrentY = intTop
Me.FontBold = True
'this assumes there is a text box named _
txtDollars_Left in the detail section
If Me.txtDollars_Left < 0 Then
Me.ForeColor = vbRed
End If
Me.Print Trim(Me.txtDollars_Left)
Me.CurrentY = intTop
Me.FontBold = False
Me.ForeColor = vbBlack
Me.Print " left to spend."
End Sub

--
Duane Hookom
MS Access MVP


message
Hi, I have a concatenated field and I only want the last name to
be
bolded.
Another person had this question, and I followed the path
suggested
by
the
inimitable Stephan Lebans. I copied his code into my report
though
it
debugs
on the first line ...

Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)

I'm on ACCESS 2000 - does this make a difference?

Also - what is the code for making it in CAPITALS as well?
 
I thought you were using my sample code when you are actually using
Stephen's. Did you try change a line of his code to:
Me.Print UCase(strLast);
or change the last name to upper case in the report's record source.

--
Duane Hookom
MS Access MVP


Sue Compelling said:
Voici - you'll see I've kept all of Stefan's explanation and title in here
as
well .....

' **START CODE
' Written by Stephen Lebans 1999
' (e-mail address removed)
' www.lebans.com

' This sample database is for a Poster named "Lady".
' She wanted to print her concatenated Control with
' one part in Bold and the rest normal.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Const TWIPS = 1
Dim strFirst As String
Dim strLast As String
Dim intPosition As Integer
Dim CtlDetail As Control
Dim intMargin As Integer

'I'll leave in Italic and Color in case you want to use these'
Dim oldFontBold As Integer
Dim oldFontItalic As Integer
Dim oldForeColor As Long
Dim oldFontName As String
Dim oldfontsize As Integer
Dim oldScaleMode As Integer

'Save current Font settings
With Me
oldFontItalic = .FontItalic
oldFontBold = .FontBold
oldForeColor = .ForeColor
oldFontName = .FontName
oldfontsize = .FontSize
oldScaleMode = .ScaleMode
End With

' Remember for this sample I am naming your control tblady. You MUST
' change the name here to match that of the actual control. Also
' I assumed the control source is exactly as you posted to the NG
' =[LastName]&", "&[FirstName]
' OK lets find your control and seperate the concatenated field.
' for each control in details control
For Each CtlDetail In Me.Section(acDetail).Controls
If CtlDetail.Name = "CombinedName" Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
strLast = Left(.Value, intPosition - 1)
strFirst = Mid(.Value, intPosition + 2)
'Debug.Print strLast
'Debug.Print strFirst

End With

With Me
'Make sure we are in Twips
.ScaleMode = TWIPS

'Grab Controls current Font settings
.FontName = CtlDetail.FontName
.FontSize = CtlDetail.FontSize

'Create desired Font settings
'for the Last Name - Bold Text
.FontBold = True
'.FontItalic = True
'.ForeColor = RGB(255, 0, 0) 'RED
.CurrentX = CtlDetail.Left
.CurrentY = CtlDetail.Top
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font-> NO Bold for FirstName
.FontBold = False
.ForeColor = RGB(0, 0, 0)
.FontItalic = False
Me.Print strFirst


'Restore Reports original Font settings
.ScaleMode = oldScaleMode
.FontBold = oldFontBold
.FontItalic = oldFontItalic
.FontName = oldFontName
.FontSize = oldfontsize
.ForeColor = oldForeColor

End With

End If
Next

' Cleanup
Set CtlDetail = Nothing
End Sub

--
Sue Compelling


Duane Hookom said:
My suggestion is for you to reply back with your code.

--
Duane Hookom
MS Access MVP


message
Hi Duane .... tried that and it printpreviewed the whole field in
uppercase
[not just the last name of the concatenated field] AND it also
'superimposed'
itself over the field currently there. Any other suggestions?
--
Sue Compelling


:

What did your attempt look like? Did you try something like:
Me.Print UCase(Trim(Me.txtDollars_Left))


--
Duane Hookom
MS Access MVP


message
Hi Duane

I tried that in the body of the code 'where the formatting is
established' -
though it didn't work. This is to make the Lastname of the
concatenated
field in capitals [as well as bold] as per my previous post. Is
there
something else I should be trying?

--
Sue Compelling


:

Any text that you want to display in upper case, use the function
UCase([YourExpression])

--
Duane Hookom
MS Access MVP


message
Hi Duane - thanks for this. When I went in again the code
worked!!!.
Fabbo
- though do you know what the command is for MAKING CAPITALS -
Cheers
--
Sue Compelling


:

I don't know if this method will work for you but you can use
the
Print
method of the report like:
Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)
Dim intTop As Integer
Dim intLeft As Integer
Me.FontSize = 20
Me.FontName = "Arial"
intTop = 360 '1/4 inches
intLeft = 1440 '1 inch
Me.CurrentY = intTop
Me.CurrentX = intLeft
Me.Print "You have $"
Me.CurrentY = intTop
Me.FontBold = True
'this assumes there is a text box named _
txtDollars_Left in the detail section
If Me.txtDollars_Left < 0 Then
Me.ForeColor = vbRed
End If
Me.Print Trim(Me.txtDollars_Left)
Me.CurrentY = intTop
Me.FontBold = False
Me.ForeColor = vbBlack
Me.Print " left to spend."
End Sub

--
Duane Hookom
MS Access MVP


in
message
Hi, I have a concatenated field and I only want the last name
to
be
bolded.
Another person had this question, and I followed the path
suggested
by
the
inimitable Stephan Lebans. I copied his code into my report
though
it
debugs
on the first line ...

Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)

I'm on ACCESS 2000 - does this make a difference?

Also - what is the code for making it in CAPITALS as well?
 
Brilliant - that's done the trick. Thanks so much for your help Duane -
really appreciated .....
--
Sue Compelling


Duane Hookom said:
I thought you were using my sample code when you are actually using
Stephen's. Did you try change a line of his code to:
Me.Print UCase(strLast);
or change the last name to upper case in the report's record source.

--
Duane Hookom
MS Access MVP


Sue Compelling said:
Voici - you'll see I've kept all of Stefan's explanation and title in here
as
well .....

' **START CODE
' Written by Stephen Lebans 1999
' (e-mail address removed)
' www.lebans.com

' This sample database is for a Poster named "Lady".
' She wanted to print her concatenated Control with
' one part in Bold and the rest normal.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

Const TWIPS = 1
Dim strFirst As String
Dim strLast As String
Dim intPosition As Integer
Dim CtlDetail As Control
Dim intMargin As Integer

'I'll leave in Italic and Color in case you want to use these'
Dim oldFontBold As Integer
Dim oldFontItalic As Integer
Dim oldForeColor As Long
Dim oldFontName As String
Dim oldfontsize As Integer
Dim oldScaleMode As Integer

'Save current Font settings
With Me
oldFontItalic = .FontItalic
oldFontBold = .FontBold
oldForeColor = .ForeColor
oldFontName = .FontName
oldfontsize = .FontSize
oldScaleMode = .ScaleMode
End With

' Remember for this sample I am naming your control tblady. You MUST
' change the name here to match that of the actual control. Also
' I assumed the control source is exactly as you posted to the NG
' =[LastName]&", "&[FirstName]
' OK lets find your control and seperate the concatenated field.
' for each control in details control
For Each CtlDetail In Me.Section(acDetail).Controls
If CtlDetail.Name = "CombinedName" Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
strLast = Left(.Value, intPosition - 1)
strFirst = Mid(.Value, intPosition + 2)
'Debug.Print strLast
'Debug.Print strFirst

End With

With Me
'Make sure we are in Twips
.ScaleMode = TWIPS

'Grab Controls current Font settings
.FontName = CtlDetail.FontName
.FontSize = CtlDetail.FontSize

'Create desired Font settings
'for the Last Name - Bold Text
.FontBold = True
'.FontItalic = True
'.ForeColor = RGB(255, 0, 0) 'RED
.CurrentX = CtlDetail.Left
.CurrentY = CtlDetail.Top
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font-> NO Bold for FirstName
.FontBold = False
.ForeColor = RGB(0, 0, 0)
.FontItalic = False
Me.Print strFirst


'Restore Reports original Font settings
.ScaleMode = oldScaleMode
.FontBold = oldFontBold
.FontItalic = oldFontItalic
.FontName = oldFontName
.FontSize = oldfontsize
.ForeColor = oldForeColor

End With

End If
Next

' Cleanup
Set CtlDetail = Nothing
End Sub

--
Sue Compelling


Duane Hookom said:
My suggestion is for you to reply back with your code.

--
Duane Hookom
MS Access MVP


message
Hi Duane .... tried that and it printpreviewed the whole field in
uppercase
[not just the last name of the concatenated field] AND it also
'superimposed'
itself over the field currently there. Any other suggestions?
--
Sue Compelling


:

What did your attempt look like? Did you try something like:
Me.Print UCase(Trim(Me.txtDollars_Left))


--
Duane Hookom
MS Access MVP


message
Hi Duane

I tried that in the body of the code 'where the formatting is
established' -
though it didn't work. This is to make the Lastname of the
concatenated
field in capitals [as well as bold] as per my previous post. Is
there
something else I should be trying?

--
Sue Compelling


:

Any text that you want to display in upper case, use the function
UCase([YourExpression])

--
Duane Hookom
MS Access MVP


message
Hi Duane - thanks for this. When I went in again the code
worked!!!.
Fabbo
- though do you know what the command is for MAKING CAPITALS -
Cheers
--
Sue Compelling


:

I don't know if this method will work for you but you can use
the
Print
method of the report like:
Private Sub Detail_Format(Cancel As Integer, FormatCount As
Integer)
Dim intTop As Integer
Dim intLeft As Integer
Me.FontSize = 20
Me.FontName = "Arial"
intTop = 360 '1/4 inches
intLeft = 1440 '1 inch
Me.CurrentY = intTop
Me.CurrentX = intLeft
Me.Print "You have $"
Me.CurrentY = intTop
Me.FontBold = True
'this assumes there is a text box named _
txtDollars_Left in the detail section
If Me.txtDollars_Left < 0 Then
Me.ForeColor = vbRed
End If
Me.Print Trim(Me.txtDollars_Left)
Me.CurrentY = intTop
Me.FontBold = False
Me.ForeColor = vbBlack
Me.Print " left to spend."
End Sub

--
Duane Hookom
MS Access MVP


in
message
Hi, I have a concatenated field and I only want the last name
to
be
bolded.
Another person had this question, and I followed the path
suggested
by
the
inimitable Stephan Lebans. I copied his code into my report
though
it
debugs
on the first line ...

Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)

I'm on ACCESS 2000 - does this make a difference?

Also - what is the code for making it in CAPITALS as well?
 
Back
Top