none
Kill a File RRS feed

  • Question

  • I have a form with a webbrowser control. Its data source is a text box. I use a combo to open a file dialog and chose a pdf file. The path and file appear in the text box and thus opens in the webbrowser - works great.

    I then copy/rename the open file to another folder...again works great.

    Then I want to delete the original file (The one open in the webbrowser)...but I get 'permission denied (#70).

    I have written code that disables the webbrowser prioIr to the kill command...still permission denied

    I have inserted code that closes the actual form the webbrowser is on prior to the kill command...still permission denied

    I'm not looking for someone to write my code for me...just a nudge in the correct direction regarding how to accomplish deleting the file programmatically...Thanks

    Access 365 is what I am building in
    Sunday, December 15, 2019 8:48 PM

All replies

  • You can't delete an open file whether its open in a Web browser or in its default application.

    So you need to close the file first then delete it.

    You may need to wait until any file locks are cleared before you can delete successfully


    • Edited by isladogs52 Sunday, December 15, 2019 10:35 PM
    Sunday, December 15, 2019 10:33 PM
  • Have you tried navigating to another file or "about:blank" to see if that would release the lock and allow you to delete the file?

    Daniel Pineault, 2010-2019 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Monday, December 16, 2019 11:01 AM