Force another Access App to quit

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

    Force another Access App to quit

    If an Access2K ade is running, say it's named app1.ade, and I open
    app2.ade, I want app2.ade to determine if app1.ade is running, and if
    it is, I want app2.ade to close app1.ade.
    Is this easy?
    lq
  • Tony Toews

    #2
    Re: Force another Access App to quit

    laurenquantrell @hotmail.com (Lauren Quantrell) wrote:
    [color=blue]
    >If an Access2K ade is running, say it's named app1.ade, and I open
    >app2.ade, I want app2.ade to determine if app1.ade is running, and if
    >it is, I want app2.ade to close app1.ade.[/color]

    There's a means of detecting whether your app is already running and you don't want
    to have multiple copies of the app running. It works by looking for the title among
    all the open programs. (I don't recall the URL though as I don't currently have
    web access.)

    You should then be able to end the other program using some kind of API call.

    I realize this is a bit vague so if anyone else wants to jump in with specific URLs
    please do so.

    Tony
    --
    Tony Toews, Microsoft Access MVP
    Please respond only in the newsgroups so that others can
    read the entire thread of messages.
    Microsoft Access Links, Hints, Tips & Accounting Systems at

    Comment

    • Dimitri Furman

      #3
      Re: Force another Access App to quit

      On Apr 23 2004, 01:04 pm, Tony Toews <ttoews@teluspl anet.net> wrote in
      news:e1ji80hv96 jh5qdl91qcntndd v465cu4lu@4ax.c om:
      [color=blue]
      > laurenquantrell @hotmail.com (Lauren Quantrell) wrote:
      >[color=green]
      >>If an Access2K ade is running, say it's named app1.ade, and I open
      >>app2.ade, I want app2.ade to determine if app1.ade is running, and if
      >>it is, I want app2.ade to close app1.ade.[/color]
      >
      > There's a means of detecting whether your app is already running and
      > you don't want to have multiple copies of the app running. It works
      > by looking for the title among all the open programs. (I don't
      > recall the URL though as I don't currently have web access.)
      >
      > You should then be able to end the other program using some kind of
      > API call.
      >
      > I realize this is a bit vague so if anyone else wants to jump in with
      > specific URLs please do so.[/color]

      I believe this is the link:


      However, it needs to be adapted slightly to achieve the OP's goal.

      --
      remove a 9 to reply by email

      Comment

      • Lauren Quantrell

        #4
        Re: Force another Access App to quit

        Dimitri,
        Thanks for that code. I have seen some even shorter versions of this,
        but all end up using application.qui t to end the second instance of
        the just opened app. Do you know how I do the equivalent of:
        myAppName1.quit ?

        lq


        Dimitri Furman <dfurman@cloud9 9.net> wrote in message news:<Xns94D4CE 050DC51dfurmanc loud99@127.0.0. 1>...[color=blue]
        > On Apr 23 2004, 01:04 pm, Tony Toews <ttoews@teluspl anet.net> wrote in
        > news:e1ji80hv96 jh5qdl91qcntndd v465cu4lu@4ax.c om:
        >[color=green]
        > > laurenquantrell @hotmail.com (Lauren Quantrell) wrote:
        > >[color=darkred]
        > >>If an Access2K ade is running, say it's named app1.ade, and I open
        > >>app2.ade, I want app2.ade to determine if app1.ade is running, and if
        > >>it is, I want app2.ade to close app1.ade.[/color]
        > >
        > > There's a means of detecting whether your app is already running and
        > > you don't want to have multiple copies of the app running. It works
        > > by looking for the title among all the open programs. (I don't
        > > recall the URL though as I don't currently have web access.)
        > >
        > > You should then be able to end the other program using some kind of
        > > API call.
        > >
        > > I realize this is a bit vague so if anyone else wants to jump in with
        > > specific URLs please do so.[/color]
        >
        > I believe this is the link:
        > http://mvps.org/access/api/api0041.htm
        >
        > However, it needs to be adapted slightly to achieve the OP's goal.[/color]

        Comment

        • Dimitri Furman

          #5
          Re: Force another Access App to quit

          On Apr 24 2004, 09:48 am, laurenquantrell @hotmail.com (Lauren Quantrell)
          wrote in news:47e5bd72.0 404240548.493aa c2b@posting.goo gle.com:
          [color=blue]
          > Dimitri,
          > Thanks for that code. I have seen some even shorter versions of this,
          > but all end up using application.qui t to end the second instance of
          > the just opened app. Do you know how I do the equivalent of:
          > myAppName1.quit ?[/color]

          Quit is a method of the Application object. You create in instance of the
          application by using CreateObject, or point to an existing instance by
          using GetObject. Either one of those two methods will give you an object
          variable of type Application, and you can invoke its Quit method.

          If you don't want to do any of that, you still can close another Windows
          application using an API call. The code is on the same site.

          --
          remove a 9 to reply by email

          Comment

          Working...