isnoend2001
asked on
path File access error
I keep getting path File access error here error 75 and cannot determine why:
The directory only has 1 file i kill it then try to remove the directory
The directory only has 1 file i kill it then try to remove the directory
FileName = C:\Documents and Settings\All Users.WINDOWS\Documents\RoofCalculator\Bryant 4587 lotta way\RedWood Deck Bids\Bids.dat
If FileExists(FileName) Then
Kill FileName
mstrDirectoryToRemove = C:\Documents and Settings\All Users.WINDOWS\Documents\RoofCalculator\Bryant 4587 lotta way\RedWood Deck Bids
RmDir mstrDirectoryToRemove' [b]path File access error here[/b]
What could cause this ?
Just a guess, but could it be that you don't have quotes around the dir name?
Omitting the double quotes should lead to compiler errors - it is a syntax error.
The access error probably results from hidden files still being in the folder. The Thumbnail cache file used for storing the thumbnail pictures in Explorer is one you often find in folders.
The access error probably results from hidden files still being in the folder. The Thumbnail cache file used for storing the thumbnail pictures in Explorer is one you often find in folders.
ASKER
Thanks epichero22, but dir name is a variable
Dim mstrDirectoryToRemove As String
Dim mstrDirectoryToRemove As String
ASKER
Thanks Qlemo,my app created the folder and only puts in 1 file(Bids.dat)
That does not contradict what I say. Did you check with e.g.
attrib *
in a command prompt? That should list all files and folders, even system or hidden.
attrib *
in a command prompt? That should list all files and folders, even system or hidden.
ASKER
I can close the app and then reopen and delete the directory without issues
Seems that the RmDir right after killing the file causes the issue
I am going to try this:
1. Kill the file
2. Put the RmDir in a command button and try that
Seems that the RmDir right after killing the file causes the issue
I am going to try this:
1. Kill the file
2. Put the RmDir in a command button and try that
The application is closed when you try to remove the folder?
ASKER
Qlemo, No its open, but no files are open this works
I can click a button to kill the file
And Click another button to remove the directory
I will try to put both in one button
I can click a button to kill the file
And Click another button to remove the directory
I will try to put both in one button
ASKER
Putting both the kill and remove directory in a button works, don't know why
Private Sub Command2_Click()
Dim FileName As String
FileName = GetPathToCboItem(cboBids.T ext) & "\Bids.dat"
mstrDirectoryToRemove = GetPathToCboItem(cboBids.T ext)
Kill FileName
RmDir mstrDirectoryToRemove
End Sub
Private Sub Command2_Click()
Dim FileName As String
FileName = GetPathToCboItem(cboBids.T
mstrDirectoryToRemove = GetPathToCboItem(cboBids.T
Kill FileName
RmDir mstrDirectoryToRemove
End Sub
Can we consider that as sufficient? If so, just delete the question.
ASKER
No I have not found a solutation
Why? Do you need to put that into something else than a button? I don't know how we should be able to help ATM.
ASKER
yes the directories to delete are in a combobox. User selects a name and clicks the delete button the file is killed (if it exists) and the directory is removed. this is what gives the error. Putting both in a command button I initially thought worked, but further testing gave the same error
I am going to try this:
It seems that the RmDir works the next time the form is loaded not sure
I will put the path in an ini file and delete the directory the next time the form is loaded.
This should not need to be done, but for the time being this may be a work around, if it works
I am going to try this:
It seems that the RmDir works the next time the form is loaded not sure
I will put the path in an ini file and delete the directory the next time the form is loaded.
This should not need to be done, but for the time being this may be a work around, if it works
If that is the case, you still have something accessing the folder. E.g. setting it as current directory - some file selection boxes do that by default
ASKER
Thanks Qlemo
My workaround did not work, still the same error.
I have an ini file here C:\Documents and Settings\All Users.WINDOWS\Documents\Ro ofCalculat or\AppFold er
It is in the same path, could this be causing the problem ?
My workaround did not work, still the same error.
I have an ini file here C:\Documents and Settings\All Users.WINDOWS\Documents\Ro
It is in the same path, could this be causing the problem ?
You told us that there is NO other file, now there is an INI in the same folder? Of course that will prevent removing the folder.
ASKER
The file is not in the folder I am trying to remove only in the path
I have an ini file here C:\Documents and Settings\All Users.WINDOWS\Documents\Ro ofCalculat or\AppFold er
folder to remove:
C:\Documents and Settings\All Users.WINDOWS\Documents\Ro ofCalculat or\Bryant 4587 lotta way\RedWood Deck Bids
I have an ini file here C:\Documents and Settings\All Users.WINDOWS\Documents\Ro
folder to remove:
C:\Documents and Settings\All Users.WINDOWS\Documents\Ro
Then there is no relation, the INI file does not matter.
Do you use anything like a dialog to choose a path and or file name using the filesystem?
At the same moment you get the error in your application, are you able to delete the folder in Explorer while the app still runs?
Do you use anything like a dialog to choose a path and or file name using the filesystem?
At the same moment you get the error in your application, are you able to delete the folder in Explorer while the app still runs?
ASKER
Do you use anything like a dialog to choose a path and or file name using the filesystem?
No the folder and folder title is created when typed into a combox
Private Function OpenFromFile()'should have been a sub
On Error GoTo e
Dim FF As Integer
Dim MyFile As String 'added
20 FF = FreeFile
30
MyFile = mstrSelectedCboPath'
40 If FileExists(MyFile) Then 'FileExists in module
50 Open MyFile For Binary As #FF
60 Get #FF, , ArrayDim
70 ReDim RoofCompany(ArrayDim)
80 Get #FF, , RoofCompanyTotal
90 Get #FF, , RoofCompany
100 Close #FF
110 Else
120 Exit Function
130 End If
140 Exit Function
e:
ShowError err.Number, err.Description, "Function OpenFromFile", Erl 'write to file and display error
End Function
the save is pretty much the same:
ArrayDim = UBound(RoofCompany)'should have been a sub
Open MyFile For Binary As #FF
Put #FF, , ArrayDim
Put #FF, , RoofCompanyTotal
Put #FF, , RoofCompany
Close #FF
no the folder cannot be deleted thru Explorer "access denied error, but i can kill the file thru the app, just not the folder
No the folder and folder title is created when typed into a combox
Private Function OpenFromFile()'should have been a sub
On Error GoTo e
Dim FF As Integer
Dim MyFile As String 'added
20 FF = FreeFile
30
MyFile = mstrSelectedCboPath'
40 If FileExists(MyFile) Then 'FileExists in module
50 Open MyFile For Binary As #FF
60 Get #FF, , ArrayDim
70 ReDim RoofCompany(ArrayDim)
80 Get #FF, , RoofCompanyTotal
90 Get #FF, , RoofCompany
100 Close #FF
110 Else
120 Exit Function
130 End If
140 Exit Function
e:
ShowError err.Number, err.Description, "Function OpenFromFile", Erl 'write to file and display error
End Function
the save is pretty much the same:
ArrayDim = UBound(RoofCompany)'should
Open MyFile For Binary As #FF
Put #FF, , ArrayDim
Put #FF, , RoofCompanyTotal
Put #FF, , RoofCompany
Close #FF
no the folder cannot be deleted thru Explorer "access denied error, but i can kill the file thru the app, just not the folder
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for you efforts