Results 1 to 6 of 6
  1. #1
    Delacour is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    3

    Print preview problem

    Hello,

    First of all i have 4 subreports and 1 masterreport

    In my masterreport i'm calculating the sum of the 4 subreports with the following



    =[Active Directory Users met kosten Query subreport].[Report]![Text16]+[Mobile Nummers met kosten Query subreport].[Report]![Text16]+[Ultimo met kosten Query subreport].[Report]![Text16]+[Vaste Nummers Goed met kosten Query subreport].[Report]![Text16]

    And this works, but

    In my form i'm having a button called print preview. And when i want to see the report in print preview it doenst show me the sum, only: #Type?

    Does anyone knows what the problem of this could be?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    That indicates a type conversion error. You say the expression works when - in ReportView? I don't know why PrintPreview would be an issue. Do you want to provide project for analysis?
    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
    Delacour is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    3
    Ok, i need to calculate the things that people are 'renting in a company', such as:

    Loginname
    Mobile phone
    Normal phone
    Scanners

    I have the tried the following:

    Bring the total from a subreport back onto the main report

    Your subreport has a total at the end - a text box in the Report Footer section, with a Control Source like this:
    =Sum([Amount])
    Now, how do you pass that total back to the the main report?
    Stage 1

    If the subreport is called Sub1, and the text box is txtTotal, put the text box on your main report, and start with this Control Source:
    =[Sub1].[Report].[txtTotal]
    Stage 2

    Check that it works. It should do if there are records in the subreport. If not, you get #Error. To avoid that, test the HasData property, like this:
    =IIf([Sub1].[Report].[HasData], [Sub1].[Report].[txtTotal], 0)
    Stage 3

    The subreport total could be Null, so you might like to use Nz() to convert that case to zero also:
    =IIf([Sub1].[Report].[HasData], Nz([Sub1].[Report].[txtTotal], 0), 0)
    Troubleshooting

    If you are stuck at some point, these further suggestions might help.
    Total does not work in the subreport

    If the basic =Sum([Amount]) does not work in the subreport:
    1. Make sure the total text box is in the Report Footer section, not the Page Footer section.
    2. Make sure the Name of this text box is not the same as the name of a field (e.g. it cannot be called Amount.)
    3. The field you are trying to sum must be a field in the report's source table/query. If Amount is a calculated text box such as:
      =[Quantity]*[PriceEach]
      then repeat the whole expression in the total box, e.g.:
      =Sum([Quantity]*[PriceEach])
    4. Make sure that what you are trying to sum is a Number, not text. See Calculated fields misinterpreted.
    Stage 1 does not work

    If the basic expression at Stage 1 above does not work:
    1. Open the main report in design view.
      Right-click the edge of the subform control, and choose Properties.
      Check the Name of the subreport control (on the Other tab of the Properties box.)
      The Name of the subreport control can be different than the name of the report it contains (its Source Object.)
    2. Uncheck the Name AutoCorrect boxes under:
      Tools | Options | General
      For details of why, see Failures caused by Name Auto-Correct
    Stage 2 does not work

    If Stage 2 does not work but Stage 1 does, you must provide 3 parts for IIf():
    • an expression that can be True or False (the HasData property in our case),
    • an expression to use when the first part is True (the value from the subreport, just like Stage 1),
    • an expression to use when the first part is False (a zero.)


    ATM i'm stuck at stage 2, what im doing is: =[Active Directory Users met kosten Query subreport].[Report].[HasData]

    From here i'm getting a true, thats correct. But when im putting part 2 behind it, im getting an error..

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Stage 2 says to use the HasData in an IIf expression. You don't show that. Show the full expression you attempted.
    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
    Delacour is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    3
    What i'm putting in is:

    =IIf([Active Directory Users met kosten Query subreport].[Report].[HasData], [Active Directory Users met kosten Query subreport].[Report].[Text16], 0)

    After this i'm getting an error about an expression ive entered has a false syntax..

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    This thread is tagged as solved. Do you still have issue?

    That syntax looks good to me. I just tested on a report. However, I always give subform container controls a name different form the form/report they hold, like: ctrActive. Then I use the control name in expression.
    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. print preview
    By rmohebian in forum Access
    Replies: 4
    Last Post: 02-14-2011, 08:10 AM
  2. Replies: 1
    Last Post: 01-10-2011, 01:08 PM
  3. Form print preview problem
    By kloss1a in forum Forms
    Replies: 3
    Last Post: 01-03-2011, 12:12 AM
  4. Print Preview different from Print Hardcopy
    By peterc in forum Reports
    Replies: 4
    Last Post: 10-27-2009, 05:35 AM
  5. Error when trying to print or print preview
    By TriAdX in forum Reports
    Replies: 8
    Last Post: 08-25-2009, 08:20 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