Results 1 to 7 of 7
  1. #1
    tonygg is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    115

    Subform printing out blank?

    Hi



    I have a form that displays lots of data in various list boxes and calculated fields. It is also larger than the width of 1 sheet of A4. Hence if you print it shows some of the totals on page 2 and is generally unpleasant.

    I wanted to allow the user to print out a simpler summary view as a record of the work done (a financial reconciliation). As the form has many hundreds of lines of code I didn't want to duplicate it into a report.

    To do this I created a subform which sits on top of the main form and on a button press on the main form it is made visible and populated with the summary data (as per the code fragment below):

    .........

    Form.[LUCY WORLDPAY RECON PRINTOUT]!TotalAdjustedSalesD = Me.TotalAdjustedSalesD
    Form.[LUCY WORLDPAY RECON PRINTOUT]!TotalUKTaxD = Me.TotalUKTaxD
    Form.[LUCY WORLDPAY RECON PRINTOUT]!TotalAdjustedShipD = Me.TotalAdjustedShipD
    Form.[LUCY WORLDPAY RECON PRINTOUT]!WPAfterCommission = Me.NetTotalWorldPayD - Me.TotalMerchantCommissionD

    If Me.[LUCY WORLDPAY RECON PRINTOUT].Visible = False Then
    Me.[LUCY WORLDPAY RECON PRINTOUT].Visible = True

    Else

    Me.[LUCY WORLDPAY RECON PRINTOUT].Visible = False

    End If

    This all works fine and the summary data appears in the sub form correctly on the screen.

    The problem I have is when I use :

    DoCmd.PrintOut acPages

    The Form with the subform on top is printed in the same layout as you see on the screen. However all the subform fields are blank. The fields that you can still see on the main form all have the correct values.

    The happens whether the print command is issued from the main form or the sub form.

    Please could someone help me to get the fields to appear on the printout?

    Many thanks

    tony

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why would form code be duplicated into a report?

    Forms are not intended for printing although can - I do this. However, never tried to print a form with a subform. Why can't this subform instead be a report?
    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
    tonygg is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    115
    I guess I don't have much experience of reports.

    The fields I need to print are all calculated fields based on code rather than formulae (I.e not simple to recreate). That is why I was just copying the results to the sub form using the simple access referencing parent and child relationship (please see the code example fragment in my last post). Is it possible to do the same simple referencing from a report so it picks up the calculated fields in the form when it launched? If so that's brilliant but would be grateful if you could show me how to achieve this.

    Many thanks

    tony

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Yes, textboxes on report can have expressions that reference form controls.
    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
    tonygg is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    115
    Thank you for confirming this. Would it be possible to show me a simple example line of code based on the code fragment above on how to do this. Currently the code in my first post sits in the main form and copies the contents of text boxes in the main form into text boxes in the sub form. Many thanks. Tony

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Expression in textbox on report:

    =Forms.mainformname.textboxname
    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
    tonygg is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    115
    Many thanks for your help

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

Similar Threads

  1. Replies: 1
    Last Post: 02-10-2012, 05:15 PM
  2. Eliminating blank lines when printing labels
    By tomcoll in forum Reports
    Replies: 12
    Last Post: 11-16-2011, 07:50 PM
  3. Printing reports without blank subreports.
    By mnsemple83 in forum Reports
    Replies: 2
    Last Post: 08-24-2011, 01:35 PM
  4. Printing Blank Report
    By andrewm in forum Reports
    Replies: 2
    Last Post: 11-24-2010, 05:30 PM
  5. Report printing unknown blank lines.
    By dgrzalja in forum Reports
    Replies: 10
    Last Post: 11-02-2009, 12: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
  •  
Other Forums: Microsoft Office Forums