ACC: How to Display a Line After Specific Records on a ReportID: Q155329
|
Moderate: Requires basic macro, coding, and interoperability skills.
This article describes how you can display a horizontal line after specific
detail records in a report, where the criteria for displaying the line
changes on a sliding scale.
The following example creates a report based on the Sales By Category query
in the sample database Northwind.mdb (or NWIND.MDB in version 2.0). The
report groups the records by category and sorts the records in each group
by total sales. It uses a variable called SalesPct to determine when a
hidden line control should appear on the report. In this example, there is
a red line under the first record in each group that exceeds 10% of total
sales, and also under the first record that exceeds 40% of total sales.
NOTE: In version 2.0, each time they appear in the following steps, type a
space in the following field names: CategoryName, ProductName, and
ProductSales.
Private Sub GroupHeader0_Format(Cancel As Integer, _
FormatCount As Integer)
SalesPct = .1
End Sub
Sub GroupHeader3_Format (Cancel As Integer, FormatCount As Integer)
SalesPct = .1
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me![Pcnt] >= SalesPct Then
Me![RedLine].Visible = True
Select Case SalesPct
Case .1
SalesPct = .4
Case .4
SalesPct = 999
End Select
Else
Me![RedLine].Visible = False
End If
End Sub
Sub Detail1_Format (Cancel As Integer, FormatCount As Integer)
If Me![Pcnt] >= SalesPct Then
Me![RedLine].Visible = True
Select Case SalesPct
Case .1
SalesPct = .4
Case .4
SalesPct = 999
End Select
Else
Me![RedLine].Visible = False
End If
End Sub
For more information about sorting and grouping, search the Help Index for "sorting" or "grouping" and view the Help topics provided, or ask the Microsoft Access 97 Office Assistant.
Additional query words: condition multiple
Keywords : RptEvent
Version : 2.0 7.0 97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 28, 1999