Results 1 to 9 of 9

Thread: Saving to file, file is locked how to unlock

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    souith africa
    Posts
    2

    Angry

    I am using text file saved in common delimintaer format,
    I am running an extenal program to save the file (monday.txt which already exists at the time of trying to save it)
    One of my data contol acces this file.
    then i try to overwrite the existing monday.txt file it tells me file in use)
    Pls help

  2. #2
    Member
    Join Date
    Aug 2000
    Posts
    60
    If the form with your data control is still visible, that means that the file is in use by the data control. Windows won't let you overwrite the file if it is open. One way of closing it is to unload the form with the data control. Otherwise use some other method of accessing the data, which doesn't need the data control.

    If you could show some of the code you are using it would be easier to show you the solution.
    Barend
    JHB-SA

    Nothing is impossible, except skiing through a revolving door.

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    souith africa
    Posts
    2

    Talking

    Thanks

    ill unload the form

    thanks

  4. #4
    Junior Member
    Join Date
    Oct 2000
    Posts
    16

    Question I have a similar problem NEED HELP

    My application reads a txt file using OPEN / CLOSE. Even after the application is ended, the file is in a state that will not allow the Delete function of Windows Explorer to work. What is returned is this message

    "Error Deleting File
    Cannot delete tempea: Access is denied
    Make sure the disk is not full or write-protected
    and that the file is not currently in use."

    If I reboot my PC, then I can delete the file with Windows Explorer.

    What can I do within my VB program to make this file available for normal use??



  5. #5
    Junior Member
    Join Date
    Oct 2000
    Posts
    16

    Unhappy Close does not CLOSE File

    I found a chunk of code to test whether a file was open or closed. Put it in at the end of my application and when found the file open, I used the CLOSE #5 to close the file in question. I had called the code chunk a second time to see if the file was open or closed. IT IS STILL OPEN!!

    That is why I get the problem in my previous posting.

    How can I close the file? Or figure out why it is still OPEN??


  6. #6
    Member
    Join Date
    Aug 2000
    Posts
    60
    Please post some code, maybe I can help.
    Barend
    JHB-SA

    Nothing is impossible, except skiing through a revolving door.

  7. #7
    Junior Member
    Join Date
    Oct 2000
    Posts
    16

    Smile To bar

    Thanks for the offer, but I changed the thread to the correct group... General VB and with some help have found what seems to be a problem. If my opened file is on a local D:\ drive my app works great. If my opened file is on a network drive, then the file remains open even if I use the same close command that works for a local drive.

  8. #8
    Member
    Join Date
    Aug 2000
    Posts
    60
    That is because the server system on the other machine takes a while to refresh (Up to 20 seconds). You'll find that if you wait a couple of seconds and then test for the open file, it will be closed.

    I asume this thread can be closed now.
    Barend
    JHB-SA

    Nothing is impossible, except skiing through a revolving door.

  9. #9
    Junior Member
    Join Date
    Oct 2000
    Posts
    16

    Talking To rressa

    You are the owner of this thread, as suggested by bar, would you close this thread. Thanks...

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