CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    1,792

    How do I delete an open file?

    I have a small problem where a 3rd party MS Access (97) application is running on a server and occassionally the .ldb file remains when all users are logged off. In order for us to carry out some processes, we need to be able to start the MS Access front end in single-user (exclusive) mode, but this is not possible while the .ldb file remains.

    Rebooting the server is an absolute last resort, and does kill whatever it is that is holding the .ldb open and preventing it from being deleted, however I would like to write something that will forcibly delete this .ldb file, so we can do the backup/purge etc.

    I did try to get through a change to have the server rebooted on a nightly basis, but that didn't get through our change control process. Had to write a 23 page doc explaining why we need to be able to delete this file etc etc, so I'm pretty much over it at the moment, however I *still* have to be able to delete this file, preferably without rebooting the server.

    Any ideas would be greatly appreciated - by the way, I'm thinking that I might be able to find the file-handle thru VB, the kill that etc etc.
    cheers
    niall
    Be nice to Harley riders...

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How do I delete an open file?

    Access 97? If you ever have more than 5 users, you're asking for trouble.

    I'd use SQL Express...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: How do I delete an open file?


  4. #4
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: How do I delete an open file?

    This looks helpful, Hannes.
    However, as I recall there is a freeware called "Unlocker" available in the web, somewhere.
    I had id installed for being able to delete files which where accidentally held open by some unwanted process or other. It seems to work good.

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: How do I delete an open file?

    Looked at the linked thread it appears that the user having the problem was using DAO for his data access rather than ADO. Which is not uncommon with Access 97.
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How do I delete an open file?

    Delete the LDB file, if the DB is really closed, but if it's NOT, you can lose your data...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured