Results 1 to 11 of 11

Data in Report View and Print Preview different

  1. #1
    kaaate is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2018
    Posts
    3

    Unhappy Data in Report View and Print Preview different

    Hello,



    I'm very new to Access and still teaching myself so apologies if I miss anything.

    I've created a sub report [Project Financials Income subreport] and need to have the values of the sub reports calculated in the footer of each grouping of my main report.

    I'm using =IIf(Not (IsNumeric([Project Financials Income subreport].[Report]![Text40])),0,[Project Financials Income subreport].[Report]![Text40])
    (Note: [Text40] is a =Sum formula located in my subreport Report Footer)

    This field calculates correctly in Report View/Layout View but incorrectly in Print Preview (see red circles).

    Report view
    Click image for larger version. 

Name:	report view.png 
Views:	39 
Size:	17.0 KB 
ID:	36442

    Print preview
    Click image for larger version. 

Name:	print preview.png 
Views:	38 
Size:	15.8 KB 
ID:	36443

    Does anyone have any suggestions on why these values are different in the different views? Or another formula I can try that might work in print preview?

    Thank you :)

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    7,262
    Always use print preview.

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    4,949
    Stated problem: totals are wrong in print preview. Suggestion: always use print preview. Am I misinterpreting something

    Where/how are the calculations being performed? Group header/footer in code? Group header/footer on report? Section header?
    What about the other report columns; do they calculate correctly?
    Are you switching views and causing the problem (indicates calculations being repeated by code) or does it also fail if you open in print preview only?
    Does it calculate correctly if printed?
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.
    So, like, why do you, like, start every sentence with, like, "so"?

  4. #4
    kaaate is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2018
    Posts
    3
    Hi Micron,

    Thanks for the response. The below is the [Field Name] - Location/Location - Formula of all relevant fields:
    1. [2019-2020] - Subreport [Project Financials Income subreport]/Design View/Detail - [2019-2020]
    2. [Text40] - Subreport [Project Financials Income subreport]/Design View/Report Footer - Sum([2019-2020])
    3. [Text173] - Mainreport/Design View/Group Footer - IIf(Not (IsNumeric([Project Financials Income subreport].[Report]![Text40])),0,[Project Financials Income subreport].[Report]![Text40])

    All other report columns are calculating correctly in both views.
    The field does not calculate correctly when opening print preview only (not switching views).
    The field does not calculate correctly when printed.
    The field only calculates correctly when opening in report view/layout view.

    Hope this helps

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    46,091
    I cannot replicate this issue.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    4,949
    RE #3 - this behaviour can occur when you sum on control names rather than their field names. You might try replacing text40 with the field name. As mentioned, a copy of the db might be required as I find report problems difficult to diagnose when there's so many design variables, plus I'm afraid your last post doesn't make much sense to me. The IIF expression makes me wonder why you'd need to worry about whether or not the contents are numeric.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    46,091
    @Micron, don't understand your post. AFAIK, aggregate functions cannot reference control names, only field names. Also, Text40 is an aggregation calculation control, not bound to a field, so how can a field be referenced instead?

    IsNumeric should work, but perhaps instead try Nz([Project Financials Income subreport]![Text40],0)

    I always name subform/subreport control different from the object it holds, like ctrFinancials, then code: Nz([ctrFinancials]![Text40],0)

    Note that .[Report] is not needed when using ! (bang).
    To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

  8. #8
    isladogs's Avatar
    isladogs is offline Voodoo Is Practised
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    2,992
    I've seen this happen where the report contains objects that reference form controls but the form has been closed before opening the report in print preview
    If this matches your situation, try saving the values as variables (or tempvars) and referencing those instead.
    If using a variable, you may need to create a function that pulls that value for your report
    Colin (Mendip Data Systems), previously known as ridders52 : Website, email
    If this has helped, please click the star button and leave a comment

  9. #9
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    4,949
    aggregate functions cannot reference control names, only field names
    'fraid I don't understand yours either. Isn't this what I said
    this behaviour can occur when you sum on control names rather than their field names
    As for the rest, I was referring to the report itself, not some expression used just anywhere in general but I could have made that more clear I guess. In other words, I'm saying the issue can be caused when a calculated control (such as one with a running sum) refers to a control rather than the field it's based on. To avoid this, I don't just not give a subform control and the object it holds the same name, I don't allow any control to have the same name as the field it's based on. The exception might be when I'm trouble shooting for a forum as I don't care beyond solving some unrelated issue.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    46,091
    Referencing a control name in an aggregate function returns #Error output on form and in report I get an input popup prompt. Therefore, I don't see how referencing control in aggregate function can produce behavior described by OP - which is the report calcs correctly in ReportView not PrintPreview. If control was referenced, the calc would bomb in either view.
    Last edited by June7; 12-11-2018 at 02:11 AM.
    To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

  11. #11
    kaaate is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2018
    Posts
    3
    Hi all,

    Thanks for all of the help and suggestions but unfortunately I couldn't figure out a solution to the issue, so I've reworked my source data to get rid of the subreport completely. A little more work for me preparing the data, but it meant I could get rid of the subreport which I don't have too much experience using, and just couldn't seem to produce consistent results across the views.

    Thanks again!

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

Similar Threads

  1. Report View VS Print Preview
    By deepakg27 in forum Reports
    Replies: 4
    Last Post: 07-04-2018, 07:20 PM
  2. Data changes from Report View to Print Preview
    By AccessPadawan86 in forum Reports
    Replies: 9
    Last Post: 07-24-2017, 07:49 AM
  3. Replies: 3
    Last Post: 04-28-2017, 08:51 AM
  4. Switch from Print Preview to Report View
    By MatthewR in forum Reports
    Replies: 5
    Last Post: 10-20-2015, 11:40 AM
  5. convert report view to print preview
    By DarrenUD in forum Reports
    Replies: 3
    Last Post: 03-18-2013, 11:21 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
  •  
Tech Forums: Microsoft Office Forums