Database has been placed in a state by user error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ejamnadas
    New Member
    • Oct 2008
    • 9

    Database has been placed in a state by user error

    Hello,

    I'm recieving the following run-time error:

    Database has been placed in a start by user 'Admin" on machine 'Machine' that prevents it from being opened or locked.

    This is the code that I get the error on

    MyDB = "H:\DataManagem ent.mdb"
    strCnn = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & MyDB
    cnn1.Open strCnn

    and the error is on cnn.1.Open.strC nn

    Does anyone know what I might be doing wrong?
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    Check your default open mode in Access settings and make sure it is shared rather than exclusive.

    If that's not it, the last post in this thread
    access multiuser ...a state that prevents it from being opened or locked...
    mentions this may be caused by PDFMaker, but I got rid of the ribbon so I haven't experienced this problem.

    Comment

    • FishVal
      Recognized Expert Specialist
      • Jun 2007
      • 2656

      #3
      @ ejamnadas

      Just out of curiosity. Is DataManagement. mdb the same database where the code resides?

      Comment

      • ejamnadas
        New Member
        • Oct 2008
        • 9

        #4
        Thanks for the replies. Chip, I checked the default access mode, it is set to shared. Also, I have dont have adobe acrobat installed (only reader).

        FishVal,

        Yes, this is the same database the code resides.

        Here is some more information i'm not sure is helpful or not. This is the err.description error I recieve when I first open the database:

        "The item cannot be found in the collection corresponding to the requested name or ordinal". After that, I recieved the "Database has been placed in a state by user" error.

        Now after I close the database and reopen:

        I only recieved "The item cannot be found..." error. But when I remove "On Error..." code, or unless swich to design mode, and then switch back to to view mode, at which point I recieved the "database has been placed in a state.." run-time error.


        -ejamnadas

        Comment

        • FishVal
          Recognized Expert Specialist
          • Jun 2007
          • 2656

          #5
          So, it is you the user that "has placed databasein a state ... ". :)
          Database goes in locked state when there is an unsaved object in it. In your case it is code module where you write your code.

          BTW, there is no need to open connection as soon as there is already opened one. Even two.
          • ADO connection accessible via CurrentProject. Connection property.
          • DAO connection accessible via Currentdb.Conne ction property.

          There is really no reason to open an additional connection.

          As for the 2nd error - there is no place in the code you've where it could happen.

          Regards,
          Fish

          Comment

          • ChipR
            Recognized Expert Top Contributor
            • Jul 2008
            • 1289

            #6
            I tried using the CurrentProject. Connection property to get a list of the workstations connected to the backend with
            Set records = CurrentProject. Connection.Open Schema(adSchema ProviderSpecifi c, _
            , "{947bb102-5d43-11d1-bdbf-00c04fb92675}")
            but it only returned one record. Is there any way to get to all the connected users without making another connection?

            Comment

            • FishVal
              Recognized Expert Specialist
              • Jun 2007
              • 2656

              #7
              Hello, ChipR.

              I've not tested it myself.
              But code posted here definitely doesn't create new ADO connection.
              I more than sure that the author has provided a well tested code snippet. :)

              Comment

              • ChipR
                Recognized Expert Top Contributor
                • Jul 2008
                • 1289

                #8
                I just realized, it does make sense that CurrentProject. Connection is showing me only 1 user connected because it's the connection to the front end I'm running, rather than to the back end. Do you happen to know if it's possible to access the connection that linked tables are currently using if I have a form that keeps a connection open?

                Comment

                • FishVal
                  Recognized Expert Specialist
                  • Jun 2007
                  • 2656

                  #9
                  I guess it is DAO connection which doesn't support OpenSchema method.

                  Comment

                  • ejamnadas
                    New Member
                    • Oct 2008
                    • 9

                    #10
                    Fishval, Thank you for the help.

                    The currentdb.execu te command did work.

                    Comment

                    Working...