Article ID: 121358
Article Last Modified on 5/6/2003
Option Compare Database ' Use database order for string comparisons. Option Explicit
Sub ChgLinToRect (Rptname As String)
' Opens the report and changes lines to rectangles.
Dim i, numctrls
Dim rpt As Report
Dim newrect As Control
DoCmd OpenReport Rptname, A_DESIGN
Set rpt = Reports(Rptname)
numctrls = rpt.count
For i = 0 To numctrls - 1
If IsLineControl(rpt(i)) Then
' If it is a line control then create a new rectangle
' with properties like the line.
Set newrect = CreateReportControl(rpt.name, 101, _
rpt(i).section, "", "", rpt(i).left, rpt(i).top, _
rpt(i).width, rpt(i).height)
newrect.BorderStyle = rpt(i).BorderStyle
newrect.BorderColor = rpt(i).BorderColor
newrect.BorderWidth = rpt(i).BorderWidth
newrect.BorderLineStyle = rpt(i).BorderLineStyle
newrect.SpecialEffect = 0
' Delete the line.
DeleteReportControl Rptname, rpt(i).name
' Decrease counters by one.
i = i - 1
numctrls = numctrls - 1
End If
Next i
DoCmd DoMenuItem 7, 0, 2
DoCmd Close
End Sub
Function DoAllReps ()
' This function loops through all reports, changing lines to
' rectangles.
Dim db As Database
Dim i
Set db = DBEngine.Workspaces(0).Databases(0)
For i = 0 To db.Containers("Reports").Documents.Count - 1
ChgLinToRect (db.Containers("Reports").Documents(i).Name)
Next i
End Function
Function IsLineControl (Ctl As Control)
' This function tests to see if a control is a line control.
Dim x
On Error Resume Next
x = Ctl.lineslant
IsLineControl = (Err = 0)
End Function
Keywords: kberrmsg kbprint kbprb KB121358