K
KidSensation
Hello all,
I have a strange problem. I wrote a process that loops through a
folder, grabs text files one-by-one and imports them into tables in my
database. Before I start looping, I make a subdirectory so that after
I use each file (before moving on to the next one) I can move the file
into it to avoid using it again at a later date. I move the file
using an object and the movefile method. Anyway, my problem starts
after I close the database. I exit the database normally and when I
go out to the subdirectory and try to do anything with it, it tells me
that the folder is currently in use and I cannot modify it in any
way. Is there something that I should be releasing here? The only
way I can do anything with the folder is if I open up the db in design
mode, open vb editor and click stop. Even this doesn't work every
time. I am stumped. Any insight would be greatly appreciated.
Thanks.
Here is some of my code:
Set FSys = CreateObject("Scripting.FileSystemObject") 'Set the file
object
If Len(Dir(strPath & strDate, vbDirectory)) = 0 Then 'see if
the directory exists
MkDir strPath & strDate 'create the directory
End If
If strFile <> "" Then
Do While (Len(strFile) > 0)
DoCmd.CopyObject , Left(strFile, 4), acTable, strTable
'make a new table with a new name
intFileLength = Len(strFile)
InitializeDatabaseTest (Left(strFile, intFileLength -
4)) 'send filename onto the rest of process
FSys.MoveFile strPath & strFile, strPath & strDate &
"\" & strFile 'move file after done
strFile = Dir(strPath) 'get next file
Loop
Else
MsgBox ("There are no files in your directory!")
End If
I have a strange problem. I wrote a process that loops through a
folder, grabs text files one-by-one and imports them into tables in my
database. Before I start looping, I make a subdirectory so that after
I use each file (before moving on to the next one) I can move the file
into it to avoid using it again at a later date. I move the file
using an object and the movefile method. Anyway, my problem starts
after I close the database. I exit the database normally and when I
go out to the subdirectory and try to do anything with it, it tells me
that the folder is currently in use and I cannot modify it in any
way. Is there something that I should be releasing here? The only
way I can do anything with the folder is if I open up the db in design
mode, open vb editor and click stop. Even this doesn't work every
time. I am stumped. Any insight would be greatly appreciated.
Thanks.
Here is some of my code:
Set FSys = CreateObject("Scripting.FileSystemObject") 'Set the file
object
If Len(Dir(strPath & strDate, vbDirectory)) = 0 Then 'see if
the directory exists
MkDir strPath & strDate 'create the directory
End If
If strFile <> "" Then
Do While (Len(strFile) > 0)
DoCmd.CopyObject , Left(strFile, 4), acTable, strTable
'make a new table with a new name
intFileLength = Len(strFile)
InitializeDatabaseTest (Left(strFile, intFileLength -
4)) 'send filename onto the rest of process
FSys.MoveFile strPath & strFile, strPath & strDate &
"\" & strFile 'move file after done
strFile = Dir(strPath) 'get next file
Loop
Else
MsgBox ("There are no files in your directory!")
End If