Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lockup with form (2002 SP3)

    I have access lockup on exit (100% CPU forever).

    I have isolated it to the prior use of a modal dialog form that I originally dismissed from within the click event of the OK button with

    Docmd.close acform, "myform" or words to that effect

    I have since changed the click event to

    Form_myform.modal = false
    Form_myform.visible=false

    and the lockup has gone away.

    This raises several questions for me other than those about my competence <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    1. Isn't it OK to use Docmd.close in a click event?
    2. What is the modal and visible doing which is different and is that OK?

    Any light that can be shed would be really useful.

    For information - the lockup occurs much later than the form is dismissed - that is, I run a series of eight or nine macro steps after dismissing the dialog and everything looks perfectly fine - it is only on exitting Access that the lockup occurs.

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

    Re: Lockup with form (2002 SP3)

    Where is the button, on the form being closed or elsewhere? With a modal popup form (i.e., a dialog), you have to either close the object or hide it before the code that opened it can continue. That is by design, so that you can popup a dialog and then when the user clicks OK or Cancel, your calling code can continue. However, normally the code behind the dialog is where you close it (if you don't need any information from it) or hide it (if you need to read something from it). In the latter case, where you hide it, you need to have code in the calling form to actually close the hidden form.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Lockup with form (2002 SP3)

    Charlotte
    Thanks for the reply. Yes the button is on the form I'm trying to close.
    The Dialog form simply asks for a date, and a couple of mutually exclusive radio buttons.
    The OK button has a Click event defined that set a couple of global variables and then wanted to "exit" from this form - triggering the dillema I described.
    That is, if I do a Close in the click event, I trigger a lockup later. If I do a .visible=false I seem to be OK.

    Do I need to close the form via a later piece of code, or can I leave it to be automatically cleaned up at quit time?

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

    Re: Lockup with form (2002 SP3)

    I'm not sure what you mean by this
    <hr>I trigger a lockup later.<hr>
    When is later? Does that mean as soon as you close that modal form or do you mean when you're trying to close the project? There's a big difference. As for leaving things to be cleaned up later, that is never a good idea in Access, since its garbage collection is nearly non-existent. There is no reason why you should not be able to close a modal form from a button on that form. If you are running into problems, then I suggest you probably have some conflicting instructions in your code that are causing you difficulties. Can you post a stripped down version of the database with the two forms in it to show what's going on?
    Charlotte

  5. #5
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Lockup with form (2002 SP3)

    Charlotte
    It may be difficult bcause the DB links with ODBC to a Foxpro database. When I get back to work I'll see what I can do.

    I have a Macro that has a series of

    OPENFORM
    OPENQUERY
    OPENQUERY
    ....
    statements

    The OPENFORM is the dialog (and is done first thing, then dismissed)
    The processing 'seems' to work fine until I eventually close Access (ten minutes later) - it goes into a 100% CPU loop at that point.
    (I can avoid the lockup by using MsgBox twice in VBA, instead of the form)
    I could post the form and its code if that helped.

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

    Re: Lockup with form (2002 SP3)

    One of the biggest problems with macros is that they provide no error handling, so obviously something is going haywire but the macro doesn't give you a means of tracking it down. The hangup you describe is a not uncommon side effect of having a form open when you try to close the database. It can be caused by other things as well, but that would be my first guess. It would help if you could post the form and its code, plus the macro, even without the queries it calls.
    Charlotte

  7. #7
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Lockup with form (2002 SP3)

    Charlotte
    Thanks for trying. I find that in my debugging efforts I've lost the failed code (.close) and replaced it with working code.
    I don't really want to replicate the failure anymore. I'm now a happy camper (on this issue) at least <img src=/S/grin.gif border=0 alt=grin width=15 height=15> but I'm sure you'll see more intriguing posts from me as I stumble through the minefield.

Posting Permissions

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