Results 1 to 6 of 6
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,095

    Report's Detail Section repeats producing multiple pages

    My brain tickler of the day!

    Report where the detail section contains two (2) sub-reports. The RecordSource queries for the two sub-reports are created in code, below are the string creations prior to execution of the query defs: (The queries run without error)
    Code:
                strQReceipts = "SELECT CategoryName, Sum(Credit) AS SumOfCredit FROM tblCategories " & _
                               "INNER JOIN tblRegister ON tblCategories.CatID = tblRegister.CatID " & _
                               "WHERE (((TDate) >= #" & curRptPerBeg & "# And (TDate) <= #" & curRptPerEnd & "#)) GROUP BY CategoryName, tblRegister.CatID " & _
                               "HAVING (((tblRegister.CatID)>0));"
                
                strQExpense = "SELECT CategoryName, Sum(Debit) AS SumOfDebit FROM tblCategories " & _
                              "INNER JOIN tblRegister ON tblCategories.CatID = tblRegister.CatID " & _
                              "WHERE (((TDate) >= #" & curRptPerBeg & "# And (TDate) <= #" & curRptPerEnd & "#)) GROUP BY CategoryName, tblRegister.CatID " & _
                              "HAVING (((tblRegister.CatID)>0));"
    Just note here that the "strReceipts" query when run produces 6 records when the date bracketing is set to the month of January, 2018............... my most important clue so far. There are 6 repetitions of the "Recripts" sub-report.

    Click image for larger version. 

Name:	000.jpg 
Views:	8 
Size:	152.7 KB 
ID:	32761

    The design view of the parent report:
    Click image for larger version. 

Name:	001.jpg 
Views:	8 
Size:	75.5 KB 
ID:	32762 and its properties: Click image for larger version. 

Name:	002.jpg 
Views:	7 
Size:	64.4 KB 
ID:	32763

    When the "Receipts" query is run directly:


    Click image for larger version. 

Name:	003.jpg 
Views:	7 
Size:	28.3 KB 
ID:	32764

    The properties of the "Receipts" sub-form container:
    Click image for larger version. 

Name:	004.jpg 
Views:	8 
Size:	84.7 KB 
ID:	32765

    The SQL view of the "Receipts" query:
    Code:
    SELECT tblCategories.CategoryName, Sum(tblRegister.Credit) AS SumOfCredit
    FROM tblCategories INNER JOIN tblRegister ON tblCategories.CatID = tblRegister.CatID
    WHERE (((tblRegister.[TDate])>=#1/1/2018# And (tblRegister.[TDate])<=#1/31/2018#))
    GROUP BY tblCategories.CategoryName, tblRegister.CatID
    HAVING (((tblRegister.CatID)>0));
    So, what's going on that I get 6 repetitions of the "Detail" section of the report?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    looks normal. youre getting multiple records.
    do you want 1 client's records? then use only 1 client ID
    or
    if you want many clients, then the report should pagenate after each client id.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,095
    Thanks, but sorry I don't understand your reply. The entire sub-report pair are duplicated for each record returned by the query. There should only be one sub-report for "Receipts" and one for "Expenses". See the report example in post #1.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    What is the record source of the report itself? If it returns more than one record, those should be in a different section.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    2,095
    Thanks Paul, I had a sense it was something simple.

    The parent report was originally the basis of just the "Expenses" view of the DB. When the requirement came about to add the "Receipts" view of the DB in a combined view, it became necessary to split the task into the two sub-reports. Guess who forgot to remove the RecordSource from the Parent?

    As always,
    Bill
    (PS) Say hi to "J"

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problem Bill. "J" says hi back. We're visiting kid/grandkids in NZ. Nice and warm here right now!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 6
    Last Post: 12-14-2015, 03:25 PM
  2. Report With Two Columns in Detail Section
    By brian4uf in forum Reports
    Replies: 1
    Last Post: 05-06-2015, 09:17 PM
  3. Replies: 3
    Last Post: 04-08-2015, 02:13 PM
  4. Replies: 3
    Last Post: 06-05-2014, 03:56 PM
  5. Replies: 6
    Last Post: 03-26-2013, 12:17 PM

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