Printing Page Numbers for Report Groups

  • Thread starter יריב החביב
  • Start date
×

יריב החביב

Hello,

Please help me,

I use this kod for doing the above, but it's not working
(this from http://www.mvps.org/access/reports/rpt0013.htm)

What am i missing ???




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!menahel
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




thank you
 
B

BruceM

Is menahel the field on which you are grouping? If so, make sure the
control (text box, I expect) has a different name than the field, and try
using the control name in the code. Is PageFooter the actual name of the
footer? That is the default, I think, but you should verify that.
 
×

יריב החביב

thank you bruce,

you have brought me closer, but it isn't it, yet.

the PageFooter wasn't exactly the actual name of the footer, so i match it.

but nothing happened.

yes, 'menahel' Is the field on which I am grouping.


thanks again,
 
B

BruceM

If menahel is the name of the field, give the text box that is bound to that
field another name (txtMenahel, for instance), and try changing the line to:

GrpNameCurrent = Me!txtMenahel

The other thing is to be sure that txtMenahel is in the Group header, not
the Page header.
 
×

יריב החביב

thanks Bruce,

i ment before that 'menahel' Is the name of the text box
on which I am grouping not the field, sorry.
Is it possible that some of my refference to this kind of code is missing ?

thanks
 
B

BruceM

Click into the page footer, click View > Properties, and click the Event
tab. Does the Format line contain [Event Procedure]? If not, click the
three dots to the right of the line, click Code Builder, and click OK.
Insert the code in the VBA window that appears, between Private Sub and End
Sub.

Is Menahel in the group header?

Is ctlGrpPages the actual name of an unbound text box in the Page Footer?
 
×

יריב החביב

thank you bruce,

Somthing very mysterious happening here.

I have done all your instruction exactly, but it did not work.

When I have done it in a copy of the eplication (just what it need for this
report)

.......It Works !!!

When i export the report to the main eplication it work, but the origin
report

(and the same ) don't.

I will use the report that works as the report of my application.


thank you very very much, its took me a long time and effort.


yariv
--
תודה רבה


BruceM said:
Click into the page footer, click View > Properties, and click the Event
tab. Does the Format line contain [Event Procedure]? If not, click the
three dots to the right of the line, click Code Builder, and click OK.
Insert the code in the VBA window that appears, between Private Sub and End
Sub.

Is Menahel in the group header?

Is ctlGrpPages the actual name of an unbound text box in the Page Footer?
 

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