开发者

Access: Page numbering per group

I am trying to get "Page n of n Pages" in the page footer for each group. I can get the page number per group, but the total pages is not dependent on the number of records per group, because depending on the detail of one record, could span multiple pages.

Is th开发者_开发百科is even possible?


Found this page, but you need to leave somewhere invisible the original [Page] declaration or else it doesn't work right. ="Page " & [Page] & " of " & [Pages]


I'm not sure if this is possible. It may be that you can use code in the OnFormat event of your group to calculate the number of pages in the group, but it's not going to be accurate until you've reached the end of the group.

I really don't think there's a solution to this.

For what it's worth, it's not something I've ever needed to do. One workaround would be to print the report multiple times, once for each of your groups, using the regular "Page [Page] of [Pages]" expression. If you've got only a dozen or so groups, this wouldn't be an awful kludge. On the other hand, if you've got hundreds of groups, not so much!


Option Compare Database
Dim x As Integer

''''''''''''''' must be written in the header of your group 
Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
Page = 1    
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''' paste this code in your page footer 
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)

dalel_var.Value = Me!dalel_no
   ' to get the total number of rows in the table based on a specific "id" which we group data with it
 x = DCount("'[Me!dalel_no]'", "betakat_istath_alaam", "[dalel_no] = " & dalel_var.Value & "")

If x Mod 15 = 0 Then
x = ((x / 15) + 0.5) - 1 '' arrange your report details out of 15 rows per page
Else
x = ((x / 15) + 0.5)
End If
divide_txt = x            '''' divide_txt is a textbox in the report
End Sub
''''''''''''''''''''''''''
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜