S
Sash
I've created a database that reformats client files into a universal import
format. Basically, the user selects a file and based on the client I run a
few queries to parse names and then run the file through a program to formats
the data. At the end, I do a file copy to archive the file and then kill to
delete the original from the import directory. This works 80% of the time,
but I get "Run-time error 70" Permission Denied the other 10%. Oddly enough,
when I set breakpoints it never errors.
One thing I did notice is that this only seems to be occuring for the files
that I run through Monarch via a batch program. Again, the odd thing is that
sometimes it even works for these files. Is there a way to make sure the
file is closed before I try to kill it? Below is the code that I'm using and
I also tried to use Name, also below.
Of course, I need this fixed by Thursday so any suggestions or help would be
greatly appreciated.
Regards,
Sash
***NewNameFSN and strOrigFile are delared earlier in program****
'Move File to Archive
Dim strFile As String
Dim strMove As String
strFile = "u:\interfaces\import\FSHN.txt"
strMove = "u:\interfaces\import\archive\FSH\" & Format(Time, "HHMMSS") &
"_" & strOrigFile
Name strFile As strMove
Kill "u:\interfaces\import\FSHN.txt"
MsgBox "FSH moved to Archive."
** Also tried ***
FileCopy NewNameFSN, "u:\interfaces\import\archive\FSH\" & Format(Time,
"HHMMSS") & "_" & strOrigFile
Kill "u:\interfaces\import\FSHN.txt"
format. Basically, the user selects a file and based on the client I run a
few queries to parse names and then run the file through a program to formats
the data. At the end, I do a file copy to archive the file and then kill to
delete the original from the import directory. This works 80% of the time,
but I get "Run-time error 70" Permission Denied the other 10%. Oddly enough,
when I set breakpoints it never errors.
One thing I did notice is that this only seems to be occuring for the files
that I run through Monarch via a batch program. Again, the odd thing is that
sometimes it even works for these files. Is there a way to make sure the
file is closed before I try to kill it? Below is the code that I'm using and
I also tried to use Name, also below.
Of course, I need this fixed by Thursday so any suggestions or help would be
greatly appreciated.
Regards,
Sash
***NewNameFSN and strOrigFile are delared earlier in program****
'Move File to Archive
Dim strFile As String
Dim strMove As String
strFile = "u:\interfaces\import\FSHN.txt"
strMove = "u:\interfaces\import\archive\FSH\" & Format(Time, "HHMMSS") &
"_" & strOrigFile
Name strFile As strMove
Kill "u:\interfaces\import\FSHN.txt"
MsgBox "FSH moved to Archive."
** Also tried ***
FileCopy NewNameFSN, "u:\interfaces\import\archive\FSH\" & Format(Time,
"HHMMSS") & "_" & strOrigFile
Kill "u:\interfaces\import\FSHN.txt"