• Lockup with form (2002 SP3)

    Author
    Topic
    #414136

    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 grin

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #918362

      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.

      • #918366

        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?

        • #918372

          I’m not sure what you mean by this [indent]


          I trigger a lockup later.


          [/indent] 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?

          • #918390

            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.

            • #918462

              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.

            • #918585

              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 grin but I’m sure you’ll see more intriguing posts from me as I stumble through the minefield.

            • #918586

              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 grin but I’m sure you’ll see more intriguing posts from me as I stumble through the minefield.

          • #918391

            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.

        • #918373

          I’m not sure what you mean by this [indent]


          I trigger a lockup later.


          [/indent] 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?

      • #918367

        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?

    • #918363

      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.

    Viewing 1 reply thread
    Reply To: Lockup with form (2002 SP3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: