Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2012
    Posts
    4

    Info in header in Print Preview but now when Printed

    First let me say that I am really a novice at all of this. Most of what I know about Access I have learned by doing.

    I currently have a few forms set up where the end user selects from a drop down box, that info is fed to the query and then into the report header. This was working fine in 2003 but we just upgraded to 2007 and now it is not.

    Here is an example of what I currently have -
    The end user chooses a status from the combo box then clicks the "run" button which has this code:
    Private Sub cmdRunCorrespondencebyApprovalStatus_Click()
    DoCmd.OpenReport "rptCorrespondencebyApprovalStatus-AllProjects", acViewPreview
    Me.Undo
    DoCmd.Close acForm, "frmChooseApprovalStatus-ReferenceforReport"
    End Sub

    In the query I am simply using this criteria:
    [Forms]![frmChooseApprovalStatus-ReferenceforReport]![cboApprovalStatus]

    In the Report I have a label:
    =Forms![frmChooseApprovalStatus-ReferenceforReport]!cboApprovalStatus

    When it opens in Print Preview it is fine. If you actually print it or change the view there is nothing there.



    I know what is happening is the form is closing without that information being communicated to the final report, but I'm not sure how to fix it. Some of what I tried:
    I moved the code to close the form to the close action of the report. Fixed the header issue but then me.undo didn't work and a new record was created every time a report was run.
    I tried to unbound the form but wasn't having any luck being able to do that and still allow selection of the combo box items.
    I put a me.undo into the "on close" of the form that didn't work.

    Hopefully this makes sense and someone can point me in the direction of possibilities to fix this issue.

    Thank you so much for your time.

  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
    Don't understand why the Undo nor why a new record is created. Do you want to provide the 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
    Join Date
    Feb 2012
    Posts
    4

    Database Attached

    June7:

    Thanks for your prompt response. I am attaching the database here in a zip. To point you in the right direction:
    It opens to the main menu.
    Click on "Reports - All Products"
    Then click on "Correspondence by Approval Status"
    Choose an approval status and then click "Run Report"
    The report will open in print preview and the header looks hunky dory.
    If you print it or change it to report view the header info disappears.

    Thanks again for any assistance you can offer.

  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
    I followed your instructions.

    The report printed fine, header and all. I cannot replicate your issue.

    Maybe your computer can't handle the font. Try some different fonts.
    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
    Join Date
    Feb 2012
    Posts
    4
    June7:

    Thanks for checking. I just ran the report and I still have the problem. If I right click after it opens in print preview and change it to report view I lose the info in the header. I get "#name?" so it's obviously lost the connection. That's the same thing that happens when I print. It worked fine in Access 2003 and stopped working after our upgrade to 2007 so....

  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
    Yes, I noticed the #Name after switching to Report view and an input prompt pops up. I notice frmChoose... is not open at this point so can no longer get data from the combobox.

    The header does print but it has #Name. Oh, that is the issue. The form is closing too soon. Why 2003 worked and now 2007 doesn't, can't say.

    Alternatives:

    1. Close the form with code in report close event.

    3. Pass the combobox value to report instead of report referencing form. Can use the OpenArgs argument of DoCmd.OpenReport. Set ControlSource of textbox on report to: =[OpenArgs].
    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
    Join Date
    Feb 2012
    Posts
    4
    Yes, the form is closing before it gets communicated to that final step. Thanks for the suggestions. I will take a look.

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

Similar Threads

  1. Replies: 1
    Last Post: 08-16-2011, 10:24 AM
  2. print preview
    By rmohebian in forum Access
    Replies: 4
    Last Post: 02-14-2011, 08:10 AM
  3. How to print on pre printed check list
    By captgnvr in forum Reports
    Replies: 4
    Last Post: 05-13-2010, 08:15 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

Tags for this Thread

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