|
I am using Lebans lady example to mix Bold and Normal in a single line text box, I have altered it and I still cant get it to bold the text I need bolded I have pasted it here, can somebody help? I need Last_Name, Suff, First_Name, Middle_Name bolded, the rest normal. Thanks Melissa
' **START CODE
' Written by Stephen Lebans 1999
' Stephen@lebans.com
' 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 strLast_Name As String
Dim strSuff As String
Dim strFirst_Name As String
Dim strMiddle_Name As String
Dim strCompany As String
Dim strAddress_1 As String
Dim strCity As String
Dim strZip As String
Dim strWork_Phone As String
Dim strSpecialty_1 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 = "text3" Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
strLast_Name = Left(.Value, intPosition - 1)
strSuff = Mid(.Value, intPosition + 2)
strFirst_Name = Mid(.Value, intPosition + 2)
strMiddle_Name = Mid(.Value, intPosition + 2)
strCompany = Mid(.Value, intPosition + 2)
strAddress_1 = Mid(.Value, intPosition + 2)
strCity = Mid(.Value, intPosition + 2)
strZip = Mid(.Value, intPosition + 2)
strWork_Phone = Mid(.Value, intPosition + 2)
strSpecialty_1 = 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_Name;
Me.Print ", ";
Me.Print strSuff;
Me.Print ", ";
Me.Print strFirst_Name;
Me.Print ", ";
Me.Print strMiddle_Name;
Me.Print ", ";
' Reset Font-> NO Bold for FirstName
.FontBold = False
'.FontItalic = False
Me.Print strCompany;
Me.Print ", ";
Me.Print strAddress_1;
Me.Print ", ";
Me.Print strCity;
Me.Print ", ";
Me.Print strZip;
Me.Print ", ";
Me.Print strWork_Phone;
Me.Print ", ";
Me.Print strSpecialty_1;
' 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
|