Results 1 to 6 of 6
  1. #1
    hlogoma is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2011
    Posts
    7

    Last Record on a Report in a Group Using Access 2007

    Hi,

    I have a report Grouped on CodeName and Sorted on CodeName with 'A on top'.
    Is it possible to find the last record in a group on a report. I am thinking of a Yes/No this is the last record in this group. If so, can one then use an event such as 'on print' to set a variable.

    For example:

    Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
    If Me.txtNum = Me.txtCount And Me.txtGrCount = 1 Then
    Me.txtbox = ""
    Else
    If (this is the last record in the group) Then .... I do not know what the IF argument would be for Last Record in a Group thus the parenthesis.
    me.txtbox = "Last Record"
    end if
    Me.txtbox= "Not the last record"
    End If
    End Sub

    Thanks for any help.



    Tom.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    We can better advise if we know why you want to do this, what is it you really want to accomplish, what purpose does this serve? I mean, why do you care that it is the last record of group? No, cannot set values of textboxes on report through code.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    hlogoma is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2011
    Posts
    7
    Quote Originally Posted by June7 View Post
    We can better advise if we know why you want to do this, what is it you really want to accomplish, what purpose does this serve? I mean, why do you care that it is the last record of group? No, cannot set values of textboxes on report through code.
    Thanks for your Reply,

    I am trying to create a caption in the page footer: "Continued on next page".

    I can get it to work on most of my reports except the following conditions:

    If the GroupCount is > 1 and the records in this group do not spill over to the next page then I stll get the caption: "Continued on the next page" and another condition is that if the GroupCount =1 and the record is at the bottom of the page, I still get the caption: "Continued on the next page." I was able to take care of this condition by using a page count and checking to see that it was still the same page then the caption collapsed to: "". But on reflection it seems the last record would solve both of these conditions.

    My thinking was that if I could identify the last record in a group and that it had not spilled over to another page then I could use that fact through an 'if else' statement such that the else statement ensured that the caption was: "" instead of "Continued on the next page"

    Thanks again for any guidance or help on this.

    Tom.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    So just 'Page n of N' page numbering is not enough, you want a notation that alerts reader the group records continue on next page? Sounds very complicated. Would need to generate sequence number within each group and a count of records within each group. Then maybe a textbox with a condition if the sequence number less than the count, show the notation. Personally, I would give the reader credit they could recognize if the group data continues on next page.

    Check out http://allenbrowne.com/casu-10.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    hlogoma is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2011
    Posts
    7
    Thanks again for your reply,

    Yes it is exactly as you say and I found a solution from Duane Hookum, just as you summarized.

    Thanks for your help and guidance,

    Tom.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Would like to provide that solution? Is there a link you could post?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-14-2011, 12:15 AM
  2. Last Record in macros ACCESS 2007
    By jcsuarez in forum Programming
    Replies: 2
    Last Post: 07-09-2011, 06:24 PM
  3. Access 2007 Report footer
    By mab in forum Access
    Replies: 1
    Last Post: 05-16-2011, 09:49 AM
  4. Report w/ Subreport locks up Access 2007
    By guyc in forum Reports
    Replies: 4
    Last Post: 05-12-2011, 09:22 AM
  5. Replies: 1
    Last Post: 05-21-2009, 08:13 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums