A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using Detail.Print



 
 
Thread Tools Display Modes
  #1  
Old August 13th, 2009, 10:00 PM posted to microsoft.public.access.reports
Laurel
external usenet poster
 
Posts: 214
Default Using Detail.Print

I got some great code from a site recommended by Al Campagna (see post
"Slide to Left" for specific URL if needed.) It allows me to interrupt the
print process and set part of the string to be printed to bold. My HUGE
problem is that after finding this wonderful code and getting my report all
set up, I find that the controls that this code acts on don't show up on the
printed page - that is the hardcopy, although they show up nicely on the
screen. Can anyone help?

' **START CODE
' Written by Stephen Lebans 1999
'
'
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

' Set Margin for Border we will draw
' around your concatenated control.
intMargin = 60

' Remember for this sample I am
' naming your control txtFirstLine. 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
' =[Last Name]&", "&[First Name]
' 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 = "txtFirstLine") Or (CtlDetail.Name =
"txtSecondLine") Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
If intPosition = 0 Then
GoTo NextCTL
End If
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
If CtlDetail.Name = "txtSecondLine" Then
.CurrentY = 250
End If
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font- NO Bold for First Name
.FontBold = False
'.FontItalic = False
Me.Print strFirst


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

End With

' With CtlDetail
' 'While we are here lets draw a box around each field
' Me.Line ((.Left - intMargin), (.Top - intMargin))-Step((.Width +
(intMargin * 2)), (.Height + (intMargin * 2))), 0, B
' End With
End If
NextCTL:
Next

' Cleanup
Set CtlDetail = Nothing
End Sub


  #2  
Old August 13th, 2009, 10:25 PM posted to microsoft.public.access.reports
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Using Detail.Print

I'm sure Stephen tested that it works with hard copy too.

Try changing fonts to see whether it makes a difference.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Laurel" wrote in message
...
I got some great code from a site recommended by Al Campagna (see post
"Slide to Left" for specific URL if needed.) It allows me to interrupt the
print process and set part of the string to be printed to bold. My HUGE
problem is that after finding this wonderful code and getting my report all
set up, I find that the controls that this code acts on don't show up on
the printed page - that is the hardcopy, although they show up nicely on
the screen. Can anyone help?

' **START CODE
' Written by Stephen Lebans 1999
'
'
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

' Set Margin for Border we will draw
' around your concatenated control.
intMargin = 60

' Remember for this sample I am
' naming your control txtFirstLine. 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
' =[Last Name]&", "&[First Name]
' 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 = "txtFirstLine") Or (CtlDetail.Name =
"txtSecondLine") Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
If intPosition = 0 Then
GoTo NextCTL
End If
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
If CtlDetail.Name = "txtSecondLine" Then
.CurrentY = 250
End If
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font- NO Bold for First Name
.FontBold = False
'.FontItalic = False
Me.Print strFirst


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

End With

' With CtlDetail
' 'While we are here lets draw a box around each field
' Me.Line ((.Left - intMargin), (.Top - intMargin))-Step((.Width +
(intMargin * 2)), (.Height + (intMargin * 2))), 0, B
' End With
End If
NextCTL:
Next

' Cleanup
Set CtlDetail = Nothing
End Sub



  #3  
Old August 13th, 2009, 10:32 PM posted to microsoft.public.access.reports
Laurel
external usenet poster
 
Posts: 214
Default Using Detail.Print

??? Everything else in the report is the same font. Everything else
prints.
Yes, I'm sure it has worked on hardcopy. That's why I'm hoping for advice
on what to do.

"Douglas J. Steele" wrote in message
...
I'm sure Stephen tested that it works with hard copy too.

Try changing fonts to see whether it makes a difference.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Laurel" wrote in message
...
I got some great code from a site recommended by Al Campagna (see post
"Slide to Left" for specific URL if needed.) It allows me to interrupt
the print process and set part of the string to be printed to bold. My
HUGE problem is that after finding this wonderful code and getting my
report all set up, I find that the controls that this code acts on don't
show up on the printed page - that is the hardcopy, although they show up
nicely on the screen. Can anyone help?

' **START CODE
' Written by Stephen Lebans 1999
'
'
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

' Set Margin for Border we will draw
' around your concatenated control.
intMargin = 60

' Remember for this sample I am
' naming your control txtFirstLine. 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
' =[Last Name]&", "&[First Name]
' 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 = "txtFirstLine") Or (CtlDetail.Name =
"txtSecondLine") Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
If intPosition = 0 Then
GoTo NextCTL
End If
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
If CtlDetail.Name = "txtSecondLine" Then
.CurrentY = 250
End If
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font- NO Bold for First Name
.FontBold = False
'.FontItalic = False
Me.Print strFirst


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

End With

' With CtlDetail
' 'While we are here lets draw a box around each field
' Me.Line ((.Left - intMargin), (.Top - intMargin))-Step((.Width
+ (intMargin * 2)), (.Height + (intMargin * 2))), 0, B
' End With
End If
NextCTL:
Next

' Cleanup
Set CtlDetail = Nothing
End Sub





  #4  
Old August 13th, 2009, 10:36 PM posted to microsoft.public.access.reports
Laurel
external usenet poster
 
Posts: 214
Default Using Detail.Print

AHH!!! I've been buried in this so long I got confused. The problem is
limited to sending the output to Word and then printing. Not nearly so
critical, but, still, critical enough. I've found that sending output to
Word is often flakey. Any ideas on that front?

"Laurel" wrote in message
...
I got some great code from a site recommended by Al Campagna (see post
"Slide to Left" for specific URL if needed.) It allows me to interrupt the
print process and set part of the string to be printed to bold. My HUGE
problem is that after finding this wonderful code and getting my report all
set up, I find that the controls that this code acts on don't show up on
the printed page - that is the hardcopy, although they show up nicely on
the screen. Can anyone help?

' **START CODE
' Written by Stephen Lebans 1999
'
'
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

' Set Margin for Border we will draw
' around your concatenated control.
intMargin = 60

' Remember for this sample I am
' naming your control txtFirstLine. 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
' =[Last Name]&", "&[First Name]
' 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 = "txtFirstLine") Or (CtlDetail.Name =
"txtSecondLine") Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
If intPosition = 0 Then
GoTo NextCTL
End If
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
If CtlDetail.Name = "txtSecondLine" Then
.CurrentY = 250
End If
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font- NO Bold for First Name
.FontBold = False
'.FontItalic = False
Me.Print strFirst


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

End With

' With CtlDetail
' 'While we are here lets draw a box around each field
' Me.Line ((.Left - intMargin), (.Top - intMargin))-Step((.Width +
(intMargin * 2)), (.Height + (intMargin * 2))), 0, B
' End With
End If
NextCTL:
Next

' Cleanup
Set CtlDetail = Nothing
End Sub



  #5  
Old August 14th, 2009, 10:42 PM posted to microsoft.public.access.reports
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Using Detail.Print

Given that sending output to Word actually uses RTF, I doubt there's much
you'll be able to do.

If it's critical, you'll probably have to use Automation to open the report
you exported and reformat it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Laurel" wrote in message
...
AHH!!! I've been buried in this so long I got confused. The problem is
limited to sending the output to Word and then printing. Not nearly so
critical, but, still, critical enough. I've found that sending output to
Word is often flakey. Any ideas on that front?

"Laurel" wrote in message
...
I got some great code from a site recommended by Al Campagna (see post
"Slide to Left" for specific URL if needed.) It allows me to interrupt
the print process and set part of the string to be printed to bold. My
HUGE problem is that after finding this wonderful code and getting my
report all set up, I find that the controls that this code acts on don't
show up on the printed page - that is the hardcopy, although they show up
nicely on the screen. Can anyone help?

' **START CODE
' Written by Stephen Lebans 1999
'
'
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

' Set Margin for Border we will draw
' around your concatenated control.
intMargin = 60

' Remember for this sample I am
' naming your control txtFirstLine. 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
' =[Last Name]&", "&[First Name]
' 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 = "txtFirstLine") Or (CtlDetail.Name =
"txtSecondLine") Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
If intPosition = 0 Then
GoTo NextCTL
End If
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
If CtlDetail.Name = "txtSecondLine" Then
.CurrentY = 250
End If
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font- NO Bold for First Name
.FontBold = False
'.FontItalic = False
Me.Print strFirst


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

End With

' With CtlDetail
' 'While we are here lets draw a box around each field
' Me.Line ((.Left - intMargin), (.Top - intMargin))-Step((.Width
+ (intMargin * 2)), (.Height + (intMargin * 2))), 0, B
' End With
End If
NextCTL:
Next

' Cleanup
Set CtlDetail = Nothing
End Sub





  #6  
Old August 17th, 2009, 02:18 PM posted to microsoft.public.access.reports
Laurel
external usenet poster
 
Posts: 214
Default Using Detail.Print

What is Automation? Is it something I can download?

"Douglas J. Steele" wrote in message
...
Given that sending output to Word actually uses RTF, I doubt there's much
you'll be able to do.

If it's critical, you'll probably have to use Automation to open the
report you exported and reformat it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Laurel" wrote in message
...
AHH!!! I've been buried in this so long I got confused. The problem is
limited to sending the output to Word and then printing. Not nearly so
critical, but, still, critical enough. I've found that sending output to
Word is often flakey. Any ideas on that front?

"Laurel" wrote in message
...
I got some great code from a site recommended by Al Campagna (see post
"Slide to Left" for specific URL if needed.) It allows me to interrupt
the print process and set part of the string to be printed to bold. My
HUGE problem is that after finding this wonderful code and getting my
report all set up, I find that the controls that this code acts on don't
show up on the printed page - that is the hardcopy, although they show up
nicely on the screen. Can anyone help?

' **START CODE
' Written by Stephen Lebans 1999
'
'
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

' Set Margin for Border we will draw
' around your concatenated control.
intMargin = 60

' Remember for this sample I am
' naming your control txtFirstLine. 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
' =[Last Name]&", "&[First Name]
' 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 = "txtFirstLine") Or (CtlDetail.Name =
"txtSecondLine") Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
If intPosition = 0 Then
GoTo NextCTL
End If
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
If CtlDetail.Name = "txtSecondLine" Then
.CurrentY = 250
End If
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font- NO Bold for First Name
.FontBold = False
'.FontItalic = False
Me.Print strFirst


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

End With

' With CtlDetail
' 'While we are here lets draw a box around each field
' Me.Line ((.Left - intMargin), (.Top - intMargin))-Step((.Width
+ (intMargin * 2)), (.Height + (intMargin * 2))), 0, B
' End With
End If
NextCTL:
Next

' Cleanup
Set CtlDetail = Nothing
End Sub







  #7  
Old August 17th, 2009, 10:17 PM posted to microsoft.public.access.reports
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Using Detail.Print

"Automation" is a term used to describe the programming techniques to
control one application from another. Not all applications expose themselves
to Automation, but all of the Office apps do. While it's old,
http://support.microsoft.com/kb/260410/en-us will give you an introduction
to the topic.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Laurel" wrote in message
...
What is Automation? Is it something I can download?

"Douglas J. Steele" wrote in message
...
Given that sending output to Word actually uses RTF, I doubt there's much
you'll be able to do.

If it's critical, you'll probably have to use Automation to open the
report you exported and reformat it.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Laurel" wrote in message
...
AHH!!! I've been buried in this so long I got confused. The problem is
limited to sending the output to Word and then printing. Not nearly so
critical, but, still, critical enough. I've found that sending output
to Word is often flakey. Any ideas on that front?

"Laurel" wrote in message
...
I got some great code from a site recommended by Al Campagna (see post
"Slide to Left" for specific URL if needed.) It allows me to interrupt
the print process and set part of the string to be printed to bold. My
HUGE problem is that after finding this wonderful code and getting my
report all set up, I find that the controls that this code acts on don't
show up on the printed page - that is the hardcopy, although they show
up nicely on the screen. Can anyone help?

' **START CODE
' Written by Stephen Lebans 1999
'
'
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

' Set Margin for Border we will draw
' around your concatenated control.
intMargin = 60

' Remember for this sample I am
' naming your control txtFirstLine. 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
' =[Last Name]&", "&[First Name]
' 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 = "txtFirstLine") Or (CtlDetail.Name =
"txtSecondLine") Then
With CtlDetail
.Visible = False
intPosition = InStr(1, .Value, ",")
If intPosition = 0 Then
GoTo NextCTL
End If
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
If CtlDetail.Name = "txtSecondLine" Then
.CurrentY = 250
End If
' For some reason must be Me.Print not .Print
Me.Print strLast;
Me.Print ", ";

' Reset Font- NO Bold for First Name
.FontBold = False
'.FontItalic = False
Me.Print strFirst


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

End With

' With CtlDetail
' 'While we are here lets draw a box around each field
' Me.Line ((.Left - intMargin), (.Top -
intMargin))-Step((.Width + (intMargin * 2)), (.Height + (intMargin *
2))), 0, B
' End With
End If
NextCTL:
Next

' Cleanup
Set CtlDetail = Nothing
End Sub









 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:12 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.