DwayneS
Instructor
- Mar 29, 2002
- 70
I have to import dozens of spool files, some of which are pretty messy. All of them result in import errors and I was using a simple line of code to delete all the error tables.
Suddenly one out of a hundred files does NOT generate an error table and the code crashed. I tried to add a simple If to test for the existence of the table and it won't work. I've tried everything I know and can't get it. Anybody have a minute to fix my glitch?
Here's the piece of code that won't work.
==============
Do While FileIn <> ""
GetFile = DataPath & FileIn
ErrTable = Left(FileIn, Len(FileIn) - 4) & "_ImportErrors"
DoCmd.TransferText acImportFixed, "FACSIn", "tGetDate", GetFile, False, ""
'==== This is the If that's not working
If TableExists(ErrTable) Then
DoCmd.DeleteObject acTable, ErrTable
End If
'=========
FileIn = Dir
Loop
Dwayne Streeter, CPA, CITP
Suddenly one out of a hundred files does NOT generate an error table and the code crashed. I tried to add a simple If to test for the existence of the table and it won't work. I've tried everything I know and can't get it. Anybody have a minute to fix my glitch?
Here's the piece of code that won't work.
==============
Do While FileIn <> ""
GetFile = DataPath & FileIn
ErrTable = Left(FileIn, Len(FileIn) - 4) & "_ImportErrors"
DoCmd.TransferText acImportFixed, "FACSIn", "tGetDate", GetFile, False, ""
'==== This is the If that's not working
If TableExists(ErrTable) Then
DoCmd.DeleteObject acTable, ErrTable
End If
'=========
FileIn = Dir
Loop
Dwayne Streeter, CPA, CITP