Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically delete all Import Errors tables 2

Status
Not open for further replies.

humbleprogrammer

Programmer
Oct 30, 2002
315
US
I have a db that allows users to import text files into a pre-built table. On occasion, the imports create import error tables. The errors in these tables are not important data and I would like to automatically have the error tables deleted so the db doesn't get polluted with a bunch of import error tables. The problem is, the text files are not always named the same so the import error tables are always named something different, which makes it difficult to use the DeleteObject function. Does anyone know of a way I can use the DeleteObject to look for all tables that end in ImportErrors and delete them? Or a way I can grab the name of the file that's being imported so I can know what the name of the import error table will be?

Any suggestions are greatly appreciated.

Thanks!
 
you could put this code in a button and it will delete all tables that are like "importerror*".

On Error Resume Next:
Dim db As DAO.Database, t As DAO.TableDef, i As Integer
Set db = CurrentDb()
For i = db.TableDefs.Count - 1 To 0 Step -1
Set t = db.TableDefs(i)
If t.Name Like "importerror*" Then
db.TableDefs.Delete t.Name
End If
Next i


db.Close
 
Take a look at this thread
thread705-692461
The Right Function would have to look for the common text from each import error. In the example, the text was followed by a ). That's why I left that mark in there.

Weird ;-)

Paul
 
Thanks a million to both of you. I used a combination of both of your samples and was able to get it to work perfectly. Thanks again and a star for both of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top