Psycholicon
Registered User.
- Local time
- Today, 14:24
- Joined
- Aug 14, 2007
- Messages
- 33
Hi everyone,
I was wondering if it's possible in VB to create code for a report so that for each individual value in the group header section there is a different page numbering system (if there's three pages under product 1118, even if they're the 50th page in the report, it reads "1" "2" and "3" of "3"). I found an article that seemed perfect : http://www.mvps.org/access/reports/rpt0013.htm
but the code doesn't work for me. I don't know if it's because I have an older version (200) or if I just don't understand code well enough. Here's my code with the modifications. I have an unbound text box with the name 'ctlGrpPages' on the report
Option Compare Database
Option Explicit
Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer
Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
Dim i As Integer
If Me.Pages = 0 Then
ReDim Preserve GrpArrayPage(Me.Page + 1)
ReDim Preserve GrpArrayPages(Me.Page + 1)
GrpNameCurrent = Me![DRL Number]
If GrpNameCurrent = GrpNamePrevious Then
GrpArrayPage(Me.Page) = GrpArrayPage(Me.Page - 1) + 1
GrpPages = GrpArrayPage(Me.Page)
For i = Me.Page - ((GrpPages) - 1) To Me.Page
GrpArrayPages(i) = GrpPages
Next i
Else
GrpPage = 1
GrpArrayPage(Me.Page) = GrpPage
GrpArrayPages(Me.Page) = GrpPage
End If
Else
Me!ctlGrpPages = "Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
This doesn't affect the text box, though. If it's blank, it remains blank, if it has something in it , it doens't change. I've tried using Me!ctlGrpPages.Controlsource and Me!ctlGrpPages.Value but neither has done anything.
Thanks for any help you can give me!
I was wondering if it's possible in VB to create code for a report so that for each individual value in the group header section there is a different page numbering system (if there's three pages under product 1118, even if they're the 50th page in the report, it reads "1" "2" and "3" of "3"). I found an article that seemed perfect : http://www.mvps.org/access/reports/rpt0013.htm
but the code doesn't work for me. I don't know if it's because I have an older version (200) or if I just don't understand code well enough. Here's my code with the modifications. I have an unbound text box with the name 'ctlGrpPages' on the report
Option Compare Database
Option Explicit
Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer
Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
Dim i As Integer
If Me.Pages = 0 Then
ReDim Preserve GrpArrayPage(Me.Page + 1)
ReDim Preserve GrpArrayPages(Me.Page + 1)
GrpNameCurrent = Me![DRL Number]
If GrpNameCurrent = GrpNamePrevious Then
GrpArrayPage(Me.Page) = GrpArrayPage(Me.Page - 1) + 1
GrpPages = GrpArrayPage(Me.Page)
For i = Me.Page - ((GrpPages) - 1) To Me.Page
GrpArrayPages(i) = GrpPages
Next i
Else
GrpPage = 1
GrpArrayPage(Me.Page) = GrpPage
GrpArrayPages(Me.Page) = GrpPage
End If
Else
Me!ctlGrpPages = "Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
This doesn't affect the text box, though. If it's blank, it remains blank, if it has something in it , it doens't change. I've tried using Me!ctlGrpPages.Controlsource and Me!ctlGrpPages.Value but neither has done anything.
Thanks for any help you can give me!