Why does modal form remains visible?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DCon
    New Member
    • May 2010
    • 6

    Why does modal form remains visible?

    I'm stumped, I have a form with its pop up/modal properties both set to "yes", this form is opened in response to a "Search" command button on the primary form (DoCmd.OpenForm "frmSearch" ); after all code executes within the Search form it is coded to close without save (DoCmd.Close acForm, "frmSearch" , acSaveNo) the primary form remains loaded in the background througout. Here is the problem, the search form closes sometimes and then at other times remains open as a "ghost" image (cannot be interacted with), I have to go to task manager to kill the MSAccess process to get rid of it. Any help would be appreciated in figuring out why this form will not close; I've ensured that all record sets are set to nothing as this was in other posts as a possible reason.
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by DCon
    I'm stumped, I have a form with its pop up/modal properties both set to "yes", this form is opened in response to a "Search" command button on the primary form (DoCmd.OpenForm "frmSearch" ); after all code executes within the Search form it is coded to close without save (DoCmd.Close acForm, "frmSearch" , acSaveNo) the primary form remains loaded in the background througout. Here is the problem, the search form closes sometimes and then at other times remains open as a "ghost" image (cannot be interacted with), I have to go to task manager to kill the MSAccess process to get rid of it. Any help would be appreciated in figuring out why this form will not close; I've ensured that all record sets are set to nothing as this was in other posts as a possible reason.
    Have you got any Application.Ech o or DoCmd.Echo commands set to False not set back to True at any material time?

    Comment

    • DCon
      New Member
      • May 2010
      • 6

      #3
      Originally posted by Jim Doherty
      Have you got any Application.Ech o or DoCmd.Echo commands set to False not set back to True at any material time?
      No Application.Ech o or DoCmd.Echo commands used anywhere within the code.

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        I suppose you could try making the form invisible then closing it:

        Forms("frmSearc h").Visible = False
        DoCmd.Close acForm, "frmSearch"

        If the form is apt to be opened again before the app is closed, in it's Form_Load event make sure it's visible again

        Forms("frmSearc h").Visible = True

        BTW, I'm guessing that you think that bold argument

        DoCmd.Close acForm, "frmSearch" , acSaveNo

        refers to not saving a record, but in fact it refers to not saving design changes to the form.

        Welcome to Bytes!

        Linq ;0)>

        Comment

        • DCon
          New Member
          • May 2010
          • 6

          #5
          Originally posted by missinglinq
          I suppose you could try making the form invisible then closing it:

          Forms("frmSearc h").Visible = False
          DoCmd.Close acForm, "frmSearch"

          If the form is apt to be opened again before the app is closed, in it's Form_Load event make sure it's visible again

          Forms("frmSearc h").Visible = True

          BTW, I'm guessing that you think that bold argument

          DoCmd.Close acForm, "frmSearch" , acSaveNo

          refers to not saving a record, but in fact it refers to not saving design changes to the form.

          Welcome to Bytes!

          Linq ;0)>
          I actually tried that with no success. I've even resorted to using the following code which also fails; it seems like the form is visible on my desktop but Access doesn't even recognize the form is loaded/visible - you can't interact with it and oddly enough if you click on the Search button on the primary form another instance opens and will close but the ghost of the original form remains; the only recourse is to end the process via task manager.

          DoCmd.Close acForm, "frmSearch" , acSaveNo
          If CurrentProject. AllForms("frmSe arch").IsLoaded Then
          MsgBox ("frmSearch is still loaded, need to close it")
          DoCmd.Close acForm, "frmSearch" , acSaveNo
          End If

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            I guess the next thing I'd try (after making a back up copy of your file) would be to
            1. Create a new, blank database
            2. Import all objects from your original database into the new database
            3. Delete the original database
            4. Rename your new database to the original database name


            and see if that solves the problem.

            Linq ;0)>

            Comment

            • DCon
              New Member
              • May 2010
              • 6

              #7
              I've done that already as well, but may try again just to see if it works. Thanks for the post!

              Comment

              • DCon
                New Member
                • May 2010
                • 6

                #8
                Originally posted by missinglinq
                I guess the next thing I'd try (after making a back up copy of your file) would be to
                1. Create a new, blank database
                2. Import all objects from your original database into the new database
                3. Delete the original database
                4. Rename your new database to the original database name


                and see if that solves the problem.

                Linq ;0)>
                After copying everything over to a new accdb it still remains open as a "ghost" image; I'm not reall saavy on PC specs but I'm wondering if it's related to RAM the PC I'm using has 1.87 GB.

                Comment

                • missinglinq
                  Recognized Expert Specialist
                  • Nov 2006
                  • 3533

                  #9
                  Don't know what else to suggest, except to delete and recreate the form, assuming that it's corrupted. Have been looking and can't find any other reports of this problem, and don't run 2007 so I can't try to recreate your problem.

                  Linq ;0)>

                  Comment

                  • DCon
                    New Member
                    • May 2010
                    • 6

                    #10
                    Appreciate the help; I've resorted to changing the pop up/modal properties both set to "no" and test with that a while, can't help but think it's related to the pop up/modal properties. Going to close this out as it seems to be specific to my configuration.

                    Comment

                    Working...