Page 1 of 5 12345 LastLast
Results 1 to 15 of 71
  1. #1
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114

    Table of Contents for 2 separate Reports

    Thanks to help of some people on the forum I was able to get my Table of Contents working. I am now wondering if it is possible to have this Table of Contents look at three different reports and fill in the content.




    I.E

    Report 1 would count these pages first
    Report 2 then this one
    Report 3 then this one.

    Is this even possible?

    This is the code I am using

    https://support.microsoft.com/en-us/kb/131588

    Thanks
    Pete

  2. #2
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    It is, and probably quite easily. You need to bind UpdateToc() function to reports 2 and 3 (to proper header section of course, same way as on first report), print preview all three in order (1, then 2, then 3) and print Table Of Contents report. It should work, can't test it atm but seems trivial.

  3. #3
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    Ok, makes sense will give it a go. Thanks

  4. #4
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Make sure to bind only UpdateToc() to reports 2 and 3 and not InitToc() as this one erases "Table Of Contents" table and we don't want this to happen

  5. #5
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    Got it too work. Is there a way to pull in the titles somehow. So that the table of contents has titles for each report ..


    I.E


    Table of Contents


    Decisions Release in the Past Four weeks

    This would be one entry ........................................pg 1
    This would be another entry .......................................pg 2

    Awaiting Decision/Sentencing.

    Another entry from the above report ..................................pg 3


    Ongoing Cases

    Another entry from the above report ..................................pg 4

  6. #6
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Yes, but it would require rebuilding the whole process a bit. I don't have time for it tonight but can have a look at it tomorrow if you want.

  7. #7
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    As well seems it is only putting 1's on everything. Even though there are a few pages.

    That would be awesome thank you.
    Unfortunately this report is for the big wigs upstairs and they are picky lol.

  8. #8
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Quote Originally Posted by pharrison74 View Post
    Unfortunately this report is for the big wigs upstairs and they are picky lol.
    Yeah, they always are
    Anyway, it was quite easy to adapt it to your needs. Steps are as follow:
    1. Add another field to your "Table of Contents" table:
    Code:
    Field name: Title
    Data type: Text
    2. In design view of "Table of Contents" report add grouping section by "Title"
    3. Change UpdateToc() function code adding following:
    Code:
    Function UpdateToc(tocentry As String, Rpt As Report, sTitle As String)
       toctable.Seek "=", tocentry
       If toctable.NoMatch Then
          toctable.AddNew
          toctable!Case_Name = tocentry
          toctable![page number] = Rpt.Page
          toctable!Title = sTitle
          toctable.Update
       End If
    End Function
    4. In design mode of reports that you want to include in ToC change OnPrint property of group headers respectively to:
    Code:
    =UpdateToc([Case_Name],[Report],"Awaiting decision/sentencing/appeal")
    or
    Code:
    =UpdateToc([Case_Name],[Report],"Ongoing cases")
    depending on which report it is of course.

    And basically that's it, print preview all reports, remember that you need to cycle through all pages of them to update ToC table correctly, then Print Toc report. Done.

  9. #9
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    Ok thank you , will look at this now. Was off yesterday. Nasty snow storm

  10. #10
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    Got to step 4. However I get an error when I enter the following in Onprint .

    =UpdateToc([Case_Name],[Report],"Book Form Awaiting Decisions")
    Click image for larger version. 

Name:	Capture.JPG 
Views:	14 
Size:	20.3 KB 
ID:	23729

  11. #11
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Have you changed UpdateToc() function code first? There are 2 changes to this code and one of them is adding another argument in function header.

  12. #12
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    I have this.

    Function UpdateToc(tocentry As String, Rpt As Report)
    ' Call from the OnPrint property of the section containing
    ' the Table Of Contents Description field. Updates the Table Of
    ' Contents table.
    toctable.Seek "=", tocentry
    If toctable.NoMatch Then
    toctable.AddNew
    toctable!Description = tocentry
    toctable![page number] = Rpt.Page
    toctable!Title = sTitle
    toctable.Update
    End If
    End Function

    I use description as it seemed to work before so just left it.

  13. #13
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    You missed that red bit:
    Function UpdateToc(tocentry As String, Rpt As Report, sTitle As String)

  14. #14
    pharrison74 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    114
    Ok the error is gone but no title shows.

    When I added the grouping section in the table of contents report it does add the section but there is no field in it.. Just blank.

    Click image for larger version. 

Name:	Capture.JPG 
Views:	14 
Size:	53.5 KB 
ID:	23730

  15. #15
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Yes, you need to add this field yourself
    Click "Add existing fields" button from Design tab on ribbon and simply drag "Title" field onto report. Or add unbound text box and set its Control Source property to Title.

Page 1 of 5 12345 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-04-2014, 04:58 PM
  2. Table of Contents
    By Alex Motilal in forum Reports
    Replies: 1
    Last Post: 09-17-2012, 10:48 AM
  3. Replies: 5
    Last Post: 04-18-2012, 12:04 PM
  4. Replies: 10
    Last Post: 01-06-2012, 07:46 AM
  5. Print Separate Reports with collate
    By HendriX99 in forum Reports
    Replies: 3
    Last Post: 02-04-2011, 07:46 AM

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