Does a table exist? (1 Viewer)

KDg

Registered User.
Local time
Today, 01:00
Joined
Oct 28, 1999
Messages
181
Hi,
after importing text files into a table with a function I want the function to delete any error table that may have been generated. The way I'm doing this at present is to count the tabledefs before and after the import and then delete xxx_ImportErrors if the count is higher afterwards. Is there a way of just checking if a table name exists? I'm sure there must be but can't find it in the help files

many thanks for your help

Drew
 

dennyryan

Registered User.
Local time
Today, 01:00
Joined
Dec 21, 1999
Messages
45
This is the code that I copied from somewhere

Dim dbClient As Database
Dim tdf As TableDef
Set dbClient = CurrentDb

For Each tdf In dbClient.TableDefs
If tdf.Name = strTableName Then
DoCmd.DeleteObject acTable, strTableName
Exit Sub
End If
Next

You could monkey with the test on tdf.name to delete the 'Error" files that you're looking for.

Denny
 

KDg

Registered User.
Local time
Today, 01:00
Joined
Oct 28, 1999
Messages
181
Many thanks Denny, works perfectly

Drew
 

Users who are viewing this thread

Top Bottom