Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Apr 2002
    Location
    St. Paul, Minnesota, USA
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ADODB Connection String (1)

    Hello All,

    I posted an "Access Security" question that I have now found to be a ADODB question. I hope no one minds me re-posting the question under a different Subject....

    Running Access 2000, when I go from design mode to view mode on my forms I get the following error:

    Run-time error '-2147467259 (80004005)' The database has been placed in a state by user 'Admin' on machine 'WEIGET1' that prevents it from being opened or locked.

    What I think is happening is when I open a form in design mode, it locks the database so I can make design changes. Then, when I flip back to view mode I have some VB that is opening a connection to the database using an ADODB connection. Here is the code for the connection:

    Set Conn = New ADODB.Connection
    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:My DocumentsdatabasesCurrentCopy(Tonya)ProductRelease Control.mdb;"

    But, when the VB connection executes the database is still locked from when I was in design mode so the connection fails and gives me the runtime error. So, what can I do to be sure that there is no existing connection that locks the database and causes the VB connection to fail? Is there anyway to release a lock on the database from design mode? I need the VB connection because the form has a lot of VB code attached to it that uses the database connection to update tables and things like that, but I also need to be able to switch from design mode to view mode and back again without getting this error.

    Any ideas or suggestions are GREATLY appreciated.

    Regards,

    Amanda

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADODB Connection String (1)

    What if you close the connection in the on close or on Unload event of the form ?
    Francois

  3. #3
    Lounger
    Join Date
    Apr 2002
    Location
    St. Paul, Minnesota, USA
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ADODB Connection String (1)

    I tried that already too (closing the Conn object), but I don't think the Conn object itself is causing the problem. The database seems to be getting locked while in design mode through it's own processes, not through the VB connection that I created (cause VB code attached to a form is not executed if you are in design mode). Then, when I flip into view mode, the VB Connection I created gets executed, but because the database is locked (from previously being in design mode) the connection I try to create in VB causes the error because it cannot connect to the database because it is locked. So, how do I close or cancel the lock that was placed on the database while I was in design mode? Is there a setting somewhere that would change how a database is locked when a user has it in design mode?

    Man, I am stumped ... thanks for all of the help, and if you (or anyone else for that matter) have any other ideas, PLEASE let me know.

    Regards,
    Amanda

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: ADODB Connection String (1)

    I'll let Charlotte or one of the other moderators weigh in on whether this should be linked to the other post, but as I indicated there, I suspect your connection is not being dropped when you switch to design mode. There really isn't much overhead in ADO in opening a connection, so you can afford to do it each time a specific event on a form needs to manipulate tables.
    Wendell

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

    Re: ADODB Connection String (1)

    There is no point in having two threads running on the same question. Let's keep the conversation in this thread until a solution is found. You can always change the subject of a post, so you don't have to stick with the original "Access Security" subject you started with there.

    I'm going to lock this thread, since there are far more replies in the other one.
    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
  •