Eliminate ImportErrors table

C

ChuckW

Hi,

I have a macro that reads a text file and then imports the contents into an
access table every day. The problem is that it generates an import errors
table. The data is imported fine. I want to be able to stop access from
creating an import errors table every time. The reason is that about once a
month I have to go in and delete 30 of these tables.

Thanks,
 
K

Klatuu

I don't know if you can suppress the creation of the errors table, but here
is a sub that will delete them for you:

Sub DeleteImportErrors()
Dim lngTblCount As Long
Dim lngTblNdx As Long
Dim Tdfs As TableDefs

Set Tdfs = CurrentDb.TableDefs
lngTblCount = Tdfs.Count - 1
For lngTblNdx = 0 To lngTblCount
If InStr(Tdfs(lngTblNdx).Name, "$_ImportErrors") > 0 Then
DoCmd.DeleteObject acTable, Tdfs(lngTblNdx).Name
End If
Next lngTblNdx
End Sub
 
Top