Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How To Pause Code until Operator Closes Print Prev (a2k (9.0.3821) SR-1 Je

    How To Pause Code until Operator Closes Print Preview?
    a2k (9.0.3821) SR-1 Jet 4.0


    I have the following code on a form button.

    My objective is to have the operator bless the printing of notices before updating the file. If there is a print jam the operator can select No and reprint if necessary.

    I would like the operator to preview the report on the screen, if it were OK, select File and Print, and then press Esc Key to close the print preview.

    What

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: How To Pause Code until Operator Closes Print Prev (a2k (9.0.3821) SR-

    One option is to shift all the code (other than the open report line) into the Onclose event of the report.
    This assumes you don't use this report in another context where you don't want this to happen.
    Regards
    John



  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How To Pause Code until Operator Closes Print Prev (a2k (9.0.3821) SR-

    You can use the WithEvents keyword to trap the report events. I've attached an A2k demo that allows you to pick a customer from a combobox and preview the report for that customer. When you close the report, the calling form intercepts the report's close event. See if that gives you any ideas.
    Attached Files Attached Files
    Charlotte

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: How To Pause Code until Operator Closes Print Prev (a2k (9.0.3821) SR-

    In the form could you test if the report "IsLoaded" and if not go ahead and do the update, else throw up a dialog box to tell the user to exit from the print preview.
    Pat <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15>

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How To Pause Code until Operator Closes Print Prev (a2k (9.0.3821) SR-

    Thanks, John, Charlotte & Pat

    Another example of the power of Access. Many ways to accomplish the same thing.

    Charlotte your demo is a keeper.

    I have it working on one report already.

    On a second report that has the following in Report_Open:

    Me.RecordSource = gloGetValue("RecordSource")
    Me.OrderBy = gloGetValue("OrderBy")
    Me.OrderByOn = True

    Where do I accomplish setting RecordSource, OrderBy & OrderByOn with the code you provided?

    Thank, John

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: How To Pause Code until Operator Closes Print Prev (a2k (9.0.3821) SR-

    Here's another way that might work. I'd create a form whose sole purpose was to open a report in preview mode. From your original form, open this frmPreview with windowMode:=acdialog, and pass the report you want opened in openargs. The frmPreview will open the report. A timer event will keep checking to see if the report is opened. As soon as it doesn't detect it, then frmPreview closes. At this time, the code in your original form will continue to process.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How To Pause Code until Operator Closes Print Prev (a2k (9.0.3821) SR-

    <P ID="edit" class=small>(Edited by charlotte on 05-Mar-03 19:57. to include attachment)</P>There are a couple ways you could handle it, but the most straightforward is to leave the code in the report, but then add shells for the events you're handling from the form. In other words, you open the report in design view, select the Report_Open and Report_NoData events in the property sheet and set them to [Event Procedure], then click the builder button. That will insert an empty shell of the event procedure in there if it isn't already there. Does that make sense? Anytime you run event code from within the object itself, you need at least the shells for the procedures that will be handled from the form.

    <small>Edited several hours later<small>
    I realized that my explanation might have been as unclear to you as it was to me on rereading it, so I'm attaching a revised demo with two buttons to print a report. The second button brings up a report with code in the report's Open event and empty shells for the other events being trapped so you can see what I meant. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Attached Files Attached Files
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •