B
Bev
I cannot get this code to work. Every page has 1 of 1 on
it. Any suggestions?
CODE:
Dim DB As DAO.Database
Dim GrpPages As DAO.Recordset
Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
'Set page number to 1 when a new group starts.
Page = 1
End Sub
Function GetGrpPages()
'Find the group name.
GrpPages.Seek "=", Me![Prescriber]
If Not GrpPages.NoMatch Then
GetGrpPages = GrpPages![Page Number]
End If
End Function
Private Sub Report_Open(Cancel As Integer)
Set DB = DBEngine.workspaces(0).databases(0)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * From [Category Group Pages];"
DoCmd.SetWarnings True
Set GrpPages = DB.OpenRecordset("Category Group
Pages", DB_OPEN_TABLE)
GrpPages.Index = "PrimaryKey"
End Sub
Private Sub PageFooter_Format(Cancel As Integer,
FormatCount As Integer)
'Find the group.
GrpPages.Seek "=", Me![Prescriber]
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
'This is the first page of the group. Therefore,
add it.
GrpPages.AddNew
GrpPages![Prescriber] = Me![Prescriber]
GrpPages![Page Number] = Me.Page
GrpPages.Update
End If
End Sub
it. Any suggestions?
CODE:
Dim DB As DAO.Database
Dim GrpPages As DAO.Recordset
Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
'Set page number to 1 when a new group starts.
Page = 1
End Sub
Function GetGrpPages()
'Find the group name.
GrpPages.Seek "=", Me![Prescriber]
If Not GrpPages.NoMatch Then
GetGrpPages = GrpPages![Page Number]
End If
End Function
Private Sub Report_Open(Cancel As Integer)
Set DB = DBEngine.workspaces(0).databases(0)
DoCmd.SetWarnings False
DoCmd.RunSQL "Delete * From [Category Group Pages];"
DoCmd.SetWarnings True
Set GrpPages = DB.OpenRecordset("Category Group
Pages", DB_OPEN_TABLE)
GrpPages.Index = "PrimaryKey"
End Sub
Private Sub PageFooter_Format(Cancel As Integer,
FormatCount As Integer)
'Find the group.
GrpPages.Seek "=", Me![Prescriber]
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
'This is the first page of the group. Therefore,
add it.
GrpPages.AddNew
GrpPages![Prescriber] = Me![Prescriber]
GrpPages![Page Number] = Me.Page
GrpPages.Update
End If
End Sub