Results 1 to 8 of 8
  1. #1
    RyB77 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    4

    Shared Variable from Main Report and Subreport

    I have a textbox on my main report that references a total in my subreport. The total in my subreport is in the Report Footer section of the subreport like its suppose to be. I cant figure out why but the textbox on the main report references the previous records total from the subreport. Its always one off. Any suggestions on how to fix this?

  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,929
    What do you mean by 'previous records total'? Is this report based on an aggregate query? What is the expression in the footer textbox?

    Want to provide db for analysis? Follow instructions at bottom of my 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.

  3. #3
    RyB77 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    4
    By 'Previous Records Total' i mean that the 2nd record total on the Main report equals the first records total in the subreport. The first record is always blank and i assume thats because of using [HasData] in the IIF formula.

    Yes the report is based off an aggregated query. The expression in the Main report is =IIf([DOLI_IMWM_SELECTED_PLANT].[Report].[HasData],[DOLI_IMWM_SELECTED_PLANT].[Report].[Totals],Null) and the expression in the subreport footer is =Sum(IIf([DOLI_IMWM] Is Null And [DOLI_EWM] Is Null,1,0)).

    Attached is the database. I removed quite a bit and running the querys/reports will not work but hopefully you can see the SQL and how the report is set up. Thanks for you help!
    Attached Files Attached Files

  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,929
    The queries and reports are dependent on criteria input on form Find_NSN, which is not provided with the db. Makes analysis a bit difficult. Want to provide db with the missing object(s)? Data is also helpful, even dummy records.
    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
    RyB77 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    4
    Hopefully this will work.
    Attached Files Attached Files

  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,929
    Not sure I can be helpful. Trying to understand what you mean by '2nd record total on the Main report equals the first records total in the subreport' but just getting the report to show any data has been a challenge. The UNION query is the longest, most complex I've seen. The plant codes in ZIAR table are not all in the DOLI_IMWM table. I changed 5106 to 5103 in ZIAR table and managed to get the UNON query to retrieve one record which shows in the report. However, the subreport did not show anything when it is displayed with the main report. It does when it is opened independently. I had to also change material code in ZIAR table for the 5103 record. Now I have data showing in both parts of the report. One record in each. Explain again what it is you want the report to do?
    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.

  7. #7
    RyB77 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2012
    Posts
    4
    Thanks for trying. Most of the information is sensitive otherwise i would upload the whole database. The report works fine but i cant figure out why the subreport total doesnt match the Main report total. The main report total is just equals the subreport total if it has data. The main report total equals the previous records subreport total. It has to be because the main report's total runs before the subreport does so it gives me the previous records subreport total. I just need to figure out how to make the main report total run after the subreport.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The main report total equals the previous records subreport total.
    This really makes no sense to me. The report is showing only one record on each the main and sub forms.

    The Total_Main textbox is showing the same value from the subform Totals textbox. Sorry, I still don't understand the issue.
    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: 06-22-2012, 06:55 AM
  2. Replies: 3
    Last Post: 06-15-2012, 11:14 AM
  3. Replies: 1
    Last Post: 02-10-2012, 05:15 PM
  4. Combine Main Report with subreport
    By jortizz in forum Reports
    Replies: 2
    Last Post: 05-05-2011, 12:42 PM
  5. Replies: 4
    Last Post: 03-14-2011, 11:12 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