The following items cover topics related to Access Reports and their
use.
PrintLines - Create Vertical lines, Borders and boxes
with VBA code. Also contains function, MakeMemoFit, to force the contents of a
Memo field to fit within a fixed size TextBox control.
Updated Ver. 4.0
JustiDirect
is a database containing Functions to produce fully justified text within
standard TextBox controls on your Reports.
Allows a standard Access TextBox, bound to a Memo field to not only produce
fully justified text, but use the CanGrow/CanShrink properties as well.
Baseline - Print Fonts of
different sizes on the same BaseLine.
MakeFitSingle - Forces
the single line contents of TextBox to fit in a fixed size control.
LeaderDots is a database
containing functions to allow a user to fill in the space between 2 controls
with leading dots. ie. Pop.....$.99
ControlReports
is a database
containing functions to allow the developer programmatic control of the Report
Print Preview Window. Specifically you can access the ZOOM and Current Page
Number Controls.
Lady is a
database containing functions to allow the developer to mix Bold and Plain
formatting within a single Control. Demonstrates how to use the Print method of
the Report object.
LineSpacingA2K
is a database
containing a function to allow the LineSpacing property to function within a
CanGrow/CanShrink environment. Access 2000 only! Hack for A97 included.
ReportDrawCircles
is a database
containing a function to resize a Circle contained within an Image Control to
fit overtop a Textbox control...to circle a choice!
ReportUtilities New
OPEN Version! A suite
of utilities to enhance the Report generating ability of Access. Includes functionality
export a Report to Microsoft Word as
an exact duplicate of the original Report, including all formatting and
graphical elements. Also includes ability to print multiple pages per single
output page.
VerticalJustificationA2K
is a database
containing a function to allow for vertical centering of the contents of a Label
or TextBox control. Works with both Forms and Reports. Access 2000 only!
LastGroupHeaderFooter
is a database
containing functions to allow you to track the positions of the GroupHeader and
Footer sections in order to place text directly in the last Group Header or
Group Footer section on each page. Supports multiple columns.
SetColorBitmap is a database containing a
Report that demonstrates how to change the colors of a Bitmap
conditionally.
TextHeightWidth is a replacement for the
Report object's TextWidth and TextHeight methods. It is multiline aware and can
work in both Report and Form views.
My Raw NewsGroup Postings concerning Reports.
Make selected parts of a
concatenated Control Bold or Italic. Or can I make the first part of a string
Bold and the rest normal.
I'm having trouble with the
Has Continued property
Make selected parts of a
concatenated Control Bold or Italic. Or can I make the first part of a string
Bold and the rest normal.
'*****ORIGINAL POST
Lady wrote
> Is there a way to bold just part of a concatenated field.
>
> Ex: =[LastName]&", "&[FirstName]
>
> Could this be done and have the [LastName] ONLY bolded in a report???
I was brought up to never say NO to a Lady. :-) <gd&R>
' **START CODE
' Written by Stephen Lebans 1999
' macarthu@nbnet.nb.ca
Private Sub Detail_Format(Cancel As Integer, FormatCount 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 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 = "tbLady" 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
'.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
Next
' Cleanup
Set CtlDetail = Nothing
End Sub
' **END CODE
----------------------------------------------
Has Continued Property
The Has Continued prop is no fun to work with. I have had good success
though using it from the Section Print Event on the next page.
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me.Section(acDetail).HasContinued = True Then
Me.CurrentX = 10
Me.CurrentY = Me.Height / 2
Me.Print "....continued from previous page"
End If
End Sub
That would print the message in the current Detail Section. You probably
want it up in the Page Header. Just set CurrentY and CurrentX to
coordinates to match whatever section you want to print it in.
The opther option is to set a Global Flag back in the section as you see
it is going to become a WillContinue section and overflow to the next
page. In Access 97, any section that is going to become a
WillContinue(d)Section will be exactly 5 Twips shorter than the Control
that is causing the CanGrow to continue on to the next page.
|