[2k7] Is it possible to create a group based on the page number ?

A

AlexT.

Folks

I'm trying to create a report group based on the page number. Is this
possible ? If so what syntax should I use (I have tried [page], me.
[page]) ?

Thanks

..-alexT
 
D

Duane Hookom

Report sorting and grouping can only be based on expressions that can be
resolved in the report's record source query. You would not be able to get
the "Page" unless you knew exactly how many detail records would appear on
each page.
 
A

AlexT.

Report sorting and grouping can only be based on expressions that can be
resolved in the report's record source query. You would not be able to get
the "Page" unless you knew exactly how many detail records would appear on
each page.

Aha... you would go for a record counter and group on that ? Hmm...
unfortunately my detail section is not fixed width...

Thanks for the suggestion, though.

-AlexT
 
L

Larry Linson

AlexT. said:
Folks

I'm trying to create a report group based on the page number. Is this
possible ? If so what syntax should I use (I have tried [page], me.
[page]) ?

Thanks

.-alexT

You can't do so. I can't imagine a valid need to do so. Perhaps if you
will explain what you are trying to accomplish with such a grouping, someone
could offer a suggestion for a useful alternative.

Larry Linson
Microsoft Office Access MVP
 
A

AlexT.

Hello
You can't do so.  I can't imagine a valid need to do so.  Perhaps if you
will explain what you are trying to accomplish with such a grouping, someone
could offer a suggestion for a useful alternative.

You might be right that I am probably not taking the problem with the
adequate biais...

What I would like is a "double" floating page footer, i.e. a page
footer that prints directly after the detail section regardless of the
amount of data in the page.

Typically I have a page footer that prints at the end of every page
with items such as current page number. Works fine, no brainer.
I also want to have per page totals that print directly at the end of
the detail section. If I have 3 records in the report I want my totals
just after those records, not at the bottom of the page with the other
"standard" footer items.

How would you do this ? My "natural" answer would have been to create
a group based on the page number so that when the page changes the
group footer would print just after my data, regardless of the footer.
Apparently this is not the right approach...

Any help / suggestion most welcome.

--alexT
 
D

Duane Hookom

What defines pages in your report? Aren't your records grouped by a value in
a field? If so, you should be able to use a Group Footer section.
 
A

AlexT.

What defines pages in your report? Aren't your records grouped by a value in
a field? If so, you should be able to use a Group Footer section.

Just duping record one after the other and new page starts when the
previous is full.

I might want to try an "artificial" group to generate a group footer
and programmaticaly hide the totals from the last page footer while
retaining the other footer elements... Hmmm.... might work.

Surprised that Access doesn't have a built in feature to achieve what
seems to be a reasonably simple requirement...

--alexT
 
D

Duane Hookom

I can't imagine why this would ever be a requirement or specification in any
application.
 
A

AccessVandal via AccessMonster.com

If it's possible to have a picture link to a web site of what you intend to
do? It might help.
 
A

AccessVandal via AccessMonster.com

Hi AlexT,

Sorry about not getting back to you as I'm busy with a urgent work.

I guess it's not possible to use any groupings as according to the picture.
My solution is to use the Detail Print and Format event to add the subtotal
and in the PageFooterSection Print and Format event to add the subtotal if
there is more than one page.

You need to declare a variable on the Report module

Option Compare Database
Option Explicit
Dim pageSubTotal as Long 'you must declare the correct datatype

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
pageSubTotal = pageSubTotal + Me.Qty 'your controlname
End Sub

Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
Dim lgSubTotal As Long
lgSubTotal = pageSubTotal
Me.SubTotal = pageSubTotal ' sub total on every page
If Me.Text71 = 1 Then '
Me.subtotal = lgSubTotal
Else
If Me.Text71 > 1 Then '
Me.Grandtotal = Me.Grandtotal + lgSubTotal
Me.subtotal = Me.subtotal + Me.GrandTotal - lgSubTotal
end if
end if
pageSubTotal = 0 'clear variable
End Sub

You will need to capture the total page on the pagefootersection. Create a
control (in my case Text71) and bound the control source to "= [Pages]".
 
A

AlexT.

Hi AlexT,

Sorry about not getting back to you as I'm busy with a urgent work.

No problem at all - your help and accompanying suggestion are most
appreciated. I have implemented it and it works like a charm !

Thanks again

--alexT
 
A

AccessVandal via AccessMonster.com

Good to hear, thanks for the feedback.

AlexT. said:
No problem at all - your help and accompanying suggestion are most
appreciated. I have implemented it and it works like a charm !

Thanks again

--alexT
 

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