Nothing showing for page of pages

  • Thread starter Abro via AccessMonster.com
  • Start date
A

Abro via AccessMonster.com

I know that this subject has been explained extensively in the forum but I
have searched and cannot find a solution to my specific problem.

I have used the code as stated below:

'************ Code Start *************
' This code was originally written by James H Brooks.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' James H Brooks
'
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!CM_LASTNAME
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 = "Group Page " & GrpArrayPage(Me.Page) & " of " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
'************ Code End *************

For some reason there is nothing showing in the ctlGrpPages on my footer,
which should be showing my page of pages like it did in the past. I have the
=[Pages] hidden in the footer and I cannot find what I am doing wrong. Could
someone please help me figure out what is happening?
 
M

Marshall Barton

Abro said:
I know that this subject has been explained extensively in the forum but I
have searched and cannot find a solution to my specific problem.

I have used the code as stated below:

'************ Code Start *************
' This code was originally written by James H Brooks.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' James H Brooks
'
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!CM_LASTNAME
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 = "Group Page " & GrpArrayPage(Me.Page) & " of " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
'************ Code End *************

For some reason there is nothing showing in the ctlGrpPages on my footer,
which should be showing my page of pages like it did in the past. I have the
=[Pages] hidden in the footer and I cannot find what I am doing wrong. Could
someone please help me figure out what is happening?


Nothing jumps out at me, but then I have always had trouble
following that code.

I use what I think is a simpler approach.

Private mColPages As New Collection

Private Sub GroupFooter0_Format(Cancel As Integer,
FormatCount As Integer)
If Me.Pages = 0 Then
mColPages.Add Me.Page, "X" & groupingfield
End If
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
Me.Page = 1
End Sub

Private Sub PageFooter_Format(Cancel As Integer, FormatCount
As Integer)
If Me.Pages > 0 Then
Me.ctlGroupPages = Me.Page & " of " & mColPages("X"
& groupingfield))
End If
End Sub
 
A

Abro via AccessMonster.com

Thank you for the suggestion. I put this code in my report and I am getting
an error that says "Invalid procedure call or argument" initially I received
this error with the other code too but the error stopped after some tweaking
and it just did not display the page numbers. I have used this report for at
least a year and the problem started when I changed my formulas which have
nothing to do with the page numbers. I am a beginner at this so I am not sure
what I am missing.

Marshall said:
I know that this subject has been explained extensively in the forum but I
have searched and cannot find a solution to my specific problem.
[quoted text clipped - 47 lines]
=[Pages] hidden in the footer and I cannot find what I am doing wrong. Could
someone please help me figure out what is happening?

Nothing jumps out at me, but then I have always had trouble
following that code.

I use what I think is a simpler approach.

Private mColPages As New Collection

Private Sub GroupFooter0_Format(Cancel As Integer,
FormatCount As Integer)
If Me.Pages = 0 Then
mColPages.Add Me.Page, "X" & groupingfield
End If
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
Me.Page = 1
End Sub

Private Sub PageFooter_Format(Cancel As Integer, FormatCount
As Integer)
If Me.Pages > 0 Then
Me.ctlGroupPages = Me.Page & " of " & mColPages("X"
& groupingfield))
End If
End Sub
 
M

Marshall Barton

Maybe the extra ) at the end of the line:

Me.ctlGroupPages = Me.Page & " of " & mColPages("X" &
groupingfield))

is preventing the page footer format event procedure from
being called. If so, then I guess that you failed to ise
the Debug - Compile menu item to catch that syntax error.
Remove the extra right paren, compile your project and, if
there are no compile errors, test it again.
--
Marsh
MVP [MS Access]

Thank you for the suggestion. I put this code in my report and I am getting
an error that says "Invalid procedure call or argument" initially I received
this error with the other code too but the error stopped after some tweaking
and it just did not display the page numbers. I have used this report for at
least a year and the problem started when I changed my formulas which have
nothing to do with the page numbers. I am a beginner at this so I am not sure
what I am missing.

Marshall said:
I know that this subject has been explained extensively in the forum but I
have searched and cannot find a solution to my specific problem.
[quoted text clipped - 47 lines]
=[Pages] hidden in the footer and I cannot find what I am doing wrong. Could
someone please help me figure out what is happening?

Nothing jumps out at me, but then I have always had trouble
following that code.

I use what I think is a simpler approach.

Private mColPages As New Collection

Private Sub GroupFooter0_Format(Cancel As Integer,
FormatCount As Integer)
If Me.Pages = 0 Then
mColPages.Add Me.Page, "X" & groupingfield
End If
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer,
FormatCount As Integer)
Me.Page = 1
End Sub

Private Sub PageFooter_Format(Cancel As Integer, FormatCount
As Integer)
If Me.Pages > 0 Then
Me.ctlGroupPages = Me.Page & " of " & mColPages("X"
& groupingfield))
End If
End Sub
 
A

Abro via AccessMonster.com

I did notice the extra paranthesis and removed that. When I push the run
button it brings up a screen with what looks like a macro for Pages and when
I push run I get the invalid procedure call or argument.

Option Compare Database
Option Explicit

Sub Pages()

End Sub

I am not sure what this code does but it comes up each time I run this one.


Marshall said:
Maybe the extra ) at the end of the line:

Me.ctlGroupPages = Me.Page & " of " & mColPages("X" &
groupingfield))

is preventing the page footer format event procedure from
being called. If so, then I guess that you failed to ise
the Debug - Compile menu item to catch that syntax error.
Remove the extra right paren, compile your project and, if
there are no compile errors, test it again.
Thank you for the suggestion. I put this code in my report and I am getting
an error that says "Invalid procedure call or argument" initially I received
[quoted text clipped - 36 lines]
 
M

Marshall Barton

Abro said:
I did notice the extra paranthesis and removed that. When I push the run
button it brings up a screen with what looks like a macro for Pages and when
I push run I get the invalid procedure call or argument.

Option Compare Database
Option Explicit

Sub Pages()

End Sub

I am not sure what this code does but it comes up each time I run this one.


What are you talking about re a macro for Pages???

Where did that code come from??? That procedure does
nothing so get rid of it.
 
A

Abro via AccessMonster.com

Thank you for all of your help. I am not sure how to explain what this is
doing. I removed the macro for Pages but now each time I click on the run
button it brings up the macro box and now the only option is cancel and it
never tests my code that I entered for Group Pages. I clicked on debug-
compile and I just get that error message of "Invalid procedure call or
argument" and it never shows me where the error falls. I am thinking that I
might need to start from scratch on this one because I cannot explain what I
think the issue is. :-(

Marshall said:
I did notice the extra paranthesis and removed that. When I push the run
button it brings up a screen with what looks like a macro for Pages and when
[quoted text clipped - 8 lines]
I am not sure what this code does but it comes up each time I run this one.

What are you talking about re a macro for Pages???

Where did that code come from??? That procedure does
nothing so get rid of it.
 
M

Marshall Barton

That empty procedure I told you to remove is NOT a macro.
It is a VBA procedure in a module.

I have no idea why you are using the Run toolbar button.
That will not work for an event procedure, and neither your
original code nor my alternate can do anything unless it is
executed as part of the report's normal processing.

You ***must*** track down all the error messages that are
generated by the Compile menu item. Code can not be
executed if it is not compiled.

SInce you seem to have little or no experience working with
VBA so I want to warn you that there are mysterious bugs
associated with editing and compiling VBA code for a form or
report when the form or report is open in anything other
than DESIGN view. If you get an error and a form or report
generates an error and stops, make a note of the error and
the line of code. Then use the Run - Reset menu item and
switch the form or report to DESIGN view before typing
anything in the VBA window. Failure to follow these steps
can easily corrupt your VBA project.
 
A

Abro via AccessMonster.com

Thank you Marshall.

Marshall said:
That empty procedure I told you to remove is NOT a macro.
It is a VBA procedure in a module.

I have no idea why you are using the Run toolbar button.
That will not work for an event procedure, and neither your
original code nor my alternate can do anything unless it is
executed as part of the report's normal processing.

You ***must*** track down all the error messages that are
generated by the Compile menu item. Code can not be
executed if it is not compiled.

SInce you seem to have little or no experience working with
VBA so I want to warn you that there are mysterious bugs
associated with editing and compiling VBA code for a form or
report when the form or report is open in anything other
than DESIGN view. If you get an error and a form or report
generates an error and stops, make a note of the error and
the line of code. Then use the Run - Reset menu item and
switch the form or report to DESIGN view before typing
anything in the VBA window. Failure to follow these steps
can easily corrupt your VBA project.
Thank you for all of your help. I am not sure how to explain what this is
doing. I removed the macro for Pages but now each time I click on the run
[quoted text clipped - 4 lines]
might need to start from scratch on this one because I cannot explain what I
think the issue is. :-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top