How to "hold" execution

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    #1

    How to "hold" execution

    Hi

    I have this code as below that first runs a report and then an update query
    to set a flag so these records are not included in the report next time.

    Private Sub Command2_Click( )
    DoCmd.OpenRepor t "MyReport", acViewPreview
    DoCmd.OpenQuery "MyQuery"
    End Sub

    The problem is that as the report comes up the code execution continues and
    the query is also run to set the flags. The result is that the report is
    unable to show all the records as flags of some records are already set by
    the query while report is being loaded. How can I "halt" the execution at
    report stage and only allow the query to run when user has closed the
    report?

    Thanks

    Regards


  • abunch@centurytel.net

    #2
    Re: How to "hold&quot ; execution

    DoCmd.OpenRepor t "MyReport", acViewPreview, , , acDialog

    The 5th parameter of the OpenReport is the WindowMode. acDialog halts
    execution in the current form until the report is closed (among other
    things).

    Comment

    • Rick Brandt

      #3
      Re: How to "hold&quot ; execution

      abunch@centuryt el.net wrote:[color=blue]
      > DoCmd.OpenRepor t "MyReport", acViewPreview, , , acDialog
      >
      > The 5th parameter of the OpenReport is the WindowMode. acDialog halts
      > execution in the current form until the report is closed (among other
      > things).[/color]

      Only in A2002 or A2003 though right?

      --
      I don't check the Email account attached
      to this message. Send instead to...
      RBrandt at Hunter dot com


      Comment

      • Bas Cost Budde

        #4
        Re: How to "hold&quot ; execution

        Something of a kludge maybe:
        wrap the opening of the report in a modal form. That is, you need a very
        simple form, (probably just an OK button of 1x1 cm) with in its Open
        event the docmd.openrepor t statement. Drawback is, however, that this
        form then is, well, modal. You cannot view the whole report at once
        because that form is in the way.

        John wrote:
        [color=blue]
        > Hi
        >
        > I have this code as below that first runs a report and then an update query
        > to set a flag so these records are not included in the report next time.
        >
        > Private Sub Command2_Click( )
        > DoCmd.OpenRepor t "MyReport", acViewPreview
        > DoCmd.OpenQuery "MyQuery"
        > End Sub
        >
        > The problem is that as the report comes up the code execution continues and
        > the query is also run to set the flags. The result is that the report is
        > unable to show all the records as flags of some records are already set by
        > the query while report is being loaded. How can I "halt" the execution at
        > report stage and only allow the query to run when user has closed the
        > report?
        >
        > Thanks
        >
        > Regards
        >
        >[/color]

        --
        Bas Cost Budde, Holland

        For human replies, replace the queue with a tea

        Comment

        • Bas Cost Budde

          #5
          Re: How to "hold&quot ; execution

          Not in A97, at least! openForm has that argument, openReport doesn't.

          abunch@centuryt el.net wrote:
          [color=blue]
          > DoCmd.OpenRepor t "MyReport", acViewPreview, , , acDialog
          >
          > The 5th parameter of the OpenReport is the WindowMode. acDialog halts
          > execution in the current form until the report is closed (among other
          > things).
          >[/color]

          --
          Bas Cost Budde, Holland

          For human replies, replace the queue with a tea

          Comment

          • fredg

            #6
            Re: How to "hold&quot ; execution

            On Sun, 3 Jul 2005 18:10:07 +0100, John wrote:
            [color=blue]
            > Hi
            >
            > I have this code as below that first runs a report and then an update query
            > to set a flag so these records are not included in the report next time.
            >
            > Private Sub Command2_Click( )
            > DoCmd.OpenRepor t "MyReport", acViewPreview
            > DoCmd.OpenQuery "MyQuery"
            > End Sub
            >
            > The problem is that as the report comes up the code execution continues and
            > the query is also run to set the flags. The result is that the report is
            > unable to show all the records as flags of some records are already set by
            > the query while report is being loaded. How can I "halt" the execution at
            > report stage and only allow the query to run when user has closed the
            > report?
            >
            > Thanks
            >
            > Regards[/color]

            Only open the report from the Command button event.

            Place the OpenQuery code in the Report's Close event (or the Report
            Footer Format event).

            Note: You are running the report in preview. Is that what you want?
            The query will update the records after preview. If you then decide to
            Print the report, they will appear to have already been printed.

            If you wish to update the table records only after the report has been
            printed (not previewed), search

            for my reply to the thread started by Stephanie with the subject of
            'Knowing what you've printed' dated 6/23/2005 in
            microsoft.publi c.access.report s.
            --
            Fred
            Please only reply to this newsgroup.
            I do not reply to personal email.

            Comment

            • David W. Fenton

              #7
              Re: How to "hold&quot ; execution

              "John" <John@nospam.in fovis.co.uk> wrote in
              news:42c81bec$0 $13695$cc9e4d1f @news-text.dial.pipex .com:
              [color=blue]
              > I have this code as below that first runs a report and then an
              > update query to set a flag so these records are not included in
              > the report next time.
              >
              > Private Sub Command2_Click( )
              > DoCmd.OpenRepor t "MyReport", acViewPreview
              > DoCmd.OpenQuery "MyQuery"
              > End Sub
              >
              > The problem is that as the report comes up the code execution
              > continues and the query is also run to set the flags. The result
              > is that the report is unable to show all the records as flags of
              > some records are already set by the query while report is being
              > loaded. How can I "halt" the execution at report stage and only
              > allow the query to run when user has closed the report?[/color]

              Run the query in the report's OnClose event.

              --
              David W. Fenton http://www.bway.net/~dfenton
              dfenton at bway dot net http://www.bway.net/~dfassoc

              Comment

              Working...