Delay or Wait Subroutine

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

    #1

    Delay or Wait Subroutine



    I have a VBA program that creates and emails a series of reports to a
    mailing list. These reports are queried off tables that are linked over the
    internet to a web server. Occasionally, the ODBC connection is dropped on
    one of the large reports (perhaps do to high traffic over the web). When
    this does happen, I would like to error trap this lost ODBC connection error
    and handle it as follows:

    (a) Wait 1 Hour
    (b) Try to launch the report again.
    (c) If item b fails the second time, then close the app.

    Question:

    Could use recommendation on how to suspend a program's execution for a set
    period of time, then resume. Thanks for any help.




  • Jeffrey R. Bailey

    #2
    Re: Delay or Wait Subroutine

    In VB or VBA you can use the Timer Function, if you look it up in the help
    file the example shows exactly how to pause a program for a specified period
    of time.


    --
    Jeffrey R. Bailey
    "Mike Wiseley" <mike.wiseley@g te.net> wrote in message
    news:OlMcb.6525 $FH3.5881@nwrdd c02.gnilink.net ...[color=blue]
    >
    >
    > I have a VBA program that creates and emails a series of reports to a
    > mailing list. These reports are queried off tables that are linked over[/color]
    the[color=blue]
    > internet to a web server. Occasionally, the ODBC connection is dropped on
    > one of the large reports (perhaps do to high traffic over the web). When
    > this does happen, I would like to error trap this lost ODBC connection[/color]
    error[color=blue]
    > and handle it as follows:
    >
    > (a) Wait 1 Hour
    > (b) Try to launch the report again.
    > (c) If item b fails the second time, then close the app.
    >
    > Question:
    >
    > Could use recommendation on how to suspend a program's execution for a set
    > period of time, then resume. Thanks for any help.
    >
    >
    >
    >
    >[/color]


    Comment

    • Mike Wiseley

      #3
      Re: Delay or Wait Subroutine

      Thanks. That is exactly what I was looking for.

      "Jeffrey R. Bailey" <mrwizard1208@y ahoo.com> wrote in message
      news:zGMcb.1164 1$Of2.609245@tw ister.tampabay. rr.com...[color=blue]
      > In VB or VBA you can use the Timer Function, if you look it up in the help
      > file the example shows exactly how to pause a program for a specified[/color]
      period[color=blue]
      > of time.
      >
      >
      > --
      > Jeffrey R. Bailey
      > "Mike Wiseley" <mike.wiseley@g te.net> wrote in message
      > news:OlMcb.6525 $FH3.5881@nwrdd c02.gnilink.net ...[color=green]
      > >
      > >
      > > I have a VBA program that creates and emails a series of reports to a
      > > mailing list. These reports are queried off tables that are linked over[/color]
      > the[color=green]
      > > internet to a web server. Occasionally, the ODBC connection is dropped[/color][/color]
      on[color=blue][color=green]
      > > one of the large reports (perhaps do to high traffic over the web). When
      > > this does happen, I would like to error trap this lost ODBC connection[/color]
      > error[color=green]
      > > and handle it as follows:
      > >
      > > (a) Wait 1 Hour
      > > (b) Try to launch the report again.
      > > (c) If item b fails the second time, then close the app.
      > >
      > > Question:
      > >
      > > Could use recommendation on how to suspend a program's execution for a[/color][/color]
      set[color=blue][color=green]
      > > period of time, then resume. Thanks for any help.
      > >
      > >
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Wayne Morgan

        #4
        Re: Delay or Wait Subroutine

        You may also want to look at the Sleep API call. Once you set the API reference for it in
        a module, it is real easy to call, just

        Sleep LengthOfTime

        The advantage of this, is that it releases resources for other apps running on the system
        to use. You can find more information about this at



        --
        Wayne Morgan
        MS Access MVP

        "Mike Wiseley" <mike.wiseley@g te.net> wrote in message
        news:OlMcb.6525 $FH3.5881@nwrdd c02.gnilink.net ...[color=blue]
        >
        >
        > I have a VBA program that creates and emails a series of reports to a
        > mailing list. These reports are queried off tables that are linked over the
        > internet to a web server. Occasionally, the ODBC connection is dropped on
        > one of the large reports (perhaps do to high traffic over the web). When
        > this does happen, I would like to error trap this lost ODBC connection error
        > and handle it as follows:
        >
        > (a) Wait 1 Hour
        > (b) Try to launch the report again.
        > (c) If item b fails the second time, then close the app.
        >
        > Question:
        >
        > Could use recommendation on how to suspend a program's execution for a set
        > period of time, then resume. Thanks for any help.
        >
        >
        >
        >[/color]


        Comment

        • Mike Wiseley

          #5
          Re: Delay or Wait Subroutine

          Thanks.

          "Wayne Morgan" <comprev@hotmai l.com> wrote in message
          news:OuNcb.7805 $1m6.6677@newss vr32.news.prodi gy.com...[color=blue]
          > You may also want to look at the Sleep API call. Once you set the API[/color]
          reference for it in[color=blue]
          > a module, it is real easy to call, just
          >
          > Sleep LengthOfTime
          >
          > The advantage of this, is that it releases resources for other apps[/color]
          running on the system[color=blue]
          > to use. You can find more information about this at
          >
          > http://www.mvps.org/access/api/api0021.htm
          >
          > --
          > Wayne Morgan
          > MS Access MVP
          >
          > "Mike Wiseley" <mike.wiseley@g te.net> wrote in message
          > news:OlMcb.6525 $FH3.5881@nwrdd c02.gnilink.net ...[color=green]
          > >
          > >
          > > I have a VBA program that creates and emails a series of reports to a
          > > mailing list. These reports are queried off tables that are linked over[/color][/color]
          the[color=blue][color=green]
          > > internet to a web server. Occasionally, the ODBC connection is dropped[/color][/color]
          on[color=blue][color=green]
          > > one of the large reports (perhaps do to high traffic over the web). When
          > > this does happen, I would like to error trap this lost ODBC connection[/color][/color]
          error[color=blue][color=green]
          > > and handle it as follows:
          > >
          > > (a) Wait 1 Hour
          > > (b) Try to launch the report again.
          > > (c) If item b fails the second time, then close the app.
          > >
          > > Question:
          > >
          > > Could use recommendation on how to suspend a program's execution for a[/color][/color]
          set[color=blue][color=green]
          > > period of time, then resume. Thanks for any help.
          > >
          > >
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...