Article ID: 131937
Article Last Modified on 11/6/2000
Table: Category Group Pages
-------------------------------
Field Name: Category Name
Data Type: Text
Field Size: 15
Indexed: Yes (No Duplicates)
Field Name: Page Number
Data Type: Number
Field Size: Long Integer
Table Properties: Category Group Pages
--------------------------------------
PrimaryKey: Category Name
Option Explicit
Dim DB As Database
Dim GrpPages As RecordSet
Function GetGrpPages ()
' Return the group X of Y pages.
' Find the group name.
GrpPages.Seek "=", Me![Category name]
If Not GrpPages.NoMatch Then
GetGrpPages = Me.page & "/" & GrpPages![Page Number]
End If
End Function
Sub Report_Open (Cancel As Integer)
Set DB = dbengine.workspaces(0).databases(0)
DoCmd.RunSQL "Delete * From [Category Group Pages];"
Set GrpPages = DB.OpenRecordset("Category Group Pages", _
DB_Open_Table)
GrpPages.Index = "PrimaryKey"
End Sub
Sub GroupHeader2_Format (Cancel As Integer, FormatCount As Integer)
' Reset the page number at the start of the group.
Me.page = 1
End Sub
Sub PageFooter5_Format (Cancel As Integer, FormatCount As Integer)
' Find the group.
GrpPages.Seek "=", Me![Category name]
If Not GrpPages.NoMatch Then
' The group is already there.
If GrpPages![Page Number] < Me.page Then
GrpPages.Edit
GrpPages![Page Number] = Me.page
GrpPages.Update
End If
Else
' First page of group, so add it.
GrpPages.AddNew
GrpPages![Category name] = Me![Category name]
GrpPages![Page Number] = Me.page
GrpPages.Update
End If
End Sub
Text box:
Name: GroupXY
ControlSource: =GetGrpPages()
Text box:
Name: ReferToPages
ControlSource: =Pages
Visible: No
Additional query words: page number numbering
Keywords: kbhowto kbusage KB131937