D
Debra Farnham
Win 2K, Access 2K
Using the following code (which I believe I found in a post by Stephan
Lebans), I was able to simulate formatting parts of text within a control.
However, I cannot seem to get it to wrap on the report and it gets truncated
at the margin.
Any help getting this text to wrap would be greatly appreciated.
TIA
Debra
*********************************************************
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strFirst As String 'Unformatted text in string
Dim strEnd As String 'Remaining unformatted text
Dim strText As String 'Formatted text in string
Dim intPosition As Integer
Dim intPosition2 As Integer
Dim CtlDetail As Control
Dim strLast As String
For Each CtlDetail In Me.Section(acDetail).Controls
If CtlDetail.Name = "txtAward" Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, "to")
strFirst = Left(.Value, intPosition + 2)
strLast = Mid(.Value, intPosition + 2)
intPosition2 = InStr(1, strLast, "on")
strText = Mid(strLast, 1, intPosition2 - 1)
strEnd = Mid(strLast, intPosition2)
End With
With Me
' Grab Controls current Font settings
.FontName = CtlDetail.FontName
.fontsize = CtlDetail.fontsize
.CurrentX = CtlDetail.Left
.CurrentY = CtlDetail.Top
Me.Print strFirst;
'font effects for formatted section
.ForeColor = "16711680" 'Blue
.FontItalic = True
.FontBold = True
Me.Print strText;
' Reset Font-> NO Bold, italics or color for end of text
.ForeColor = "0" 'Black
.FontItalic = False
.FontBold = False
Me.Print strEnd
End With
End If
Next
End Sub
Using the following code (which I believe I found in a post by Stephan
Lebans), I was able to simulate formatting parts of text within a control.
However, I cannot seem to get it to wrap on the report and it gets truncated
at the margin.
Any help getting this text to wrap would be greatly appreciated.
TIA
Debra
*********************************************************
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strFirst As String 'Unformatted text in string
Dim strEnd As String 'Remaining unformatted text
Dim strText As String 'Formatted text in string
Dim intPosition As Integer
Dim intPosition2 As Integer
Dim CtlDetail As Control
Dim strLast As String
For Each CtlDetail In Me.Section(acDetail).Controls
If CtlDetail.Name = "txtAward" Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, "to")
strFirst = Left(.Value, intPosition + 2)
strLast = Mid(.Value, intPosition + 2)
intPosition2 = InStr(1, strLast, "on")
strText = Mid(strLast, 1, intPosition2 - 1)
strEnd = Mid(strLast, intPosition2)
End With
With Me
' Grab Controls current Font settings
.FontName = CtlDetail.FontName
.fontsize = CtlDetail.fontsize
.CurrentX = CtlDetail.Left
.CurrentY = CtlDetail.Top
Me.Print strFirst;
'font effects for formatted section
.ForeColor = "16711680" 'Blue
.FontItalic = True
.FontBold = True
Me.Print strText;
' Reset Font-> NO Bold, italics or color for end of text
.ForeColor = "0" 'Black
.FontItalic = False
.FontBold = False
Me.Print strEnd
End With
End If
Next
End Sub