Results 1 to 6 of 6
  1. #1
    Kevin Johnston is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Apr 2010
    Posts
    8

    Printing two versions of the same report

    I have an invoice form which, when a "Done" button is pressed, prints a one-page invoice report (sales receipt). I would like two instances of the report to print, the first for the customer copy, and the second for the store copy. The second time the report is printed, I would like to make the Visible property of a label with the text "Bookstore Copy" changed from No to Yes so it would print. Can this be easily done?

    I also tried another method of doing this by creating two reports, then printing one report for the customer and one report for the store (which has the label text "Bookstore Copy"). To do so, I just copied and pasted the original report and named the new report differently. However, the second report doesn't print, even if I haven't made any changes whatsoever after copying and pasting the original report.



    In the event code for "Done", I'm just doing a standard 'DoCmd.OpenReport "Invoice", A_NORMAL' command. In the case of the two reports method, it's just

    Code:
    DoCmd.OpenReport "Invoice", A_NORMAL
    DoCmd.OpenReport "Invoice2", A_NORMAL
    The second report (Invoice2) is the one that doesn't print.

    Help from anyone? Thanks.

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Not how I would do it, but it should work (I'd use a single report and use OpenArgs to choose when to make the label visible). Is it Invoice2 that won't print, or the second report printed? In other words, what happens if you reverse the order? Does it open/print if you open it from the Navigation Pane?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Kevin Johnston is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Apr 2010
    Posts
    8
    Paul, thanks for your response.

    Actually, I would much prefer your method of OpenArgs, just haven't used it before. I searched for openargs on-line and came up with the following code for the "Done" button on the invoice form:

    Code:
    'printing invoice
        Dim DocName As String
        DocName = "Invoice"
        DoCmd.OpenReport DocName, acViewNormal
        DoCmd.OpenReport DocName, acViewNormal, OpenArgs:="BookstoreCopy"
    Then in the report properties of the invoice report, for the "On Open" event, I place the following code:

    Code:
    If Me.OpenArgs = "BookstoreCopy" Then
        MsgBox "This worked"
        Me.BookstoreCopy.Visible = True
    End If
    The MsgBox displays properly, but the "Bookstore Copy" label doesn't print.

    Am I approaching this somehow wrong?

    Thanks.

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No, I think you're on the right track. I would have the code in the format event of whatever section that label is in. Try that and see if it works. If not, can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Kevin Johnston is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Apr 2010
    Posts
    8
    Mark this one "solved." It worked fine when I followed your suggestion to place the code in the format event of the section it was in. Actually, it might have worked the way I originally tried it, but somehow my print settings got lost and all my footer text printed below the bottom of the invoice. I haven't actually tried it - no time!

    Thanks for getting me on the right track!

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 0
    Last Post: 05-25-2011, 06:13 AM
  2. Report printing
    By Andrevw in forum Reports
    Replies: 1
    Last Post: 01-16-2011, 06:08 PM
  3. Printing Blank Report
    By andrewm in forum Reports
    Replies: 2
    Last Post: 11-24-2010, 05:30 PM
  4. Report Printing
    By newtoAccess in forum Reports
    Replies: 5
    Last Post: 12-02-2009, 07:46 PM
  5. Report Printing Error
    By gjohnson71 in forum Reports
    Replies: 4
    Last Post: 03-07-2009, 12:36 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