Results 1 to 10 of 10
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Global Event (2000, SR-1)

    Greetings!
    I'm searching for a way to call a procedure when the user quits Access.
    I can easily do this using the On Close property of a main menu/switchboard form. However, the problem comes when the user happens to exit the application from within any other form. I need to catch a "Global Exit" event (if there is such a thing).

    Any ideas?

    FYI: The application is written to run as a standalone, using the Access RT. Also, it would not be practical to assign the procedure to the OnClose event of EVERY form.

    Many thanks in advance! <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

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

    Re: Global Event (2000, SR-1)

    If you're talking about the using clicking the close button (X) on the main Access window, that isn't an event that can be trapped from within Access. You would have to do it externally.
    Charlotte

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Event (2000, SR-1)

    Thanks for the response, Charlotte. That's what I was afraid of. <img src=/S/sad.gif border=0 alt=sad width=15 height=15>

  4. #4
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Event (2000, SR-1)

    Mark, don't give up hope. <A target="_blank" HREF=http://www.mvps.org/access/general/gen0005.htm>The Access Web</A> illustrates a method of preventing closing the application, it involves firing up a hidden form when the database is opened and placing code in its Unload Event. When a user closes the progam with the X the forms are unloaded in order, having opened the hidden form first (through the autoexec macro), it's the first to close and you can cancel the close action. Using this model I'm sure you could execute whatever procedures you desire. Hope it helps. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  5. #5
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Event (2000, SR-1)

    Thanks Brian! I spend quite a bit of time at the <A target="_blank" HREF=http://www.mvps.org/access/index.html>Access Web</A>, but I seem to have overlooked the handy trick you mentioned. I think that's a winner. Thanks a million!! <img src=/S/joy.gif border=0 alt=joy width=23 height=23>

  6. #6
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Event (2000, SR-1)

    It is a terrific site <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Glad it helped.

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

    Re: Global Event (2000, SR-1)

    Does that trick apply in Access 2000, and will it fully close the database? I've seen problems with apps in 2000 that use an open but hidden form. The hidden form *does* close but Access itself doesn't and it requires Task Manager to force it to close.
    Charlotte

  8. #8
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Event (2000, SR-1)

    Yes. It works perfectly for me. (Win2K, Win98, WinNT)
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  9. #9
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Event (2000, SR-1)

    Yep - it worked like a charm! <img src=/S/groovin.gif border=0 alt=groovin width=21 height=21>
    Gotta love Dev Ashish and the others at the Access Web! <img src=/S/salute.gif border=0 alt=salute width=15 height=20>

    No hang-up problems, although I can see where that could be a problem.

    FYI: I used the OnClose event of the hidden form instead of OnUnload, simply because it is the last event to fire.

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

    Re: Global Event (2000, SR-1)

    Most of us who work primarily in Access use the OnClose event. Those who do a lot of work in VB or with Microsoft forms tend to use Unload because they don't have a Close event.
    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
  •