Delete Object

houseofturner

Registered User.
Local time
Today, 16:57
Joined
Dec 10, 2009
Messages
37
As part of a long series of import routines I use the function:

DoCmd.DeleteObject acTable, "CH32310N_ImportErrors" to clean up tables.

However I have to have one of these statements for each table error table.

Is it possible to use wildcards within this function to say for example:

DoCmd.DeleteObject acTable, "*ImportErrors*"
 
no, but you can use this, or something close to it.

Code:
dim tbl as tabledef
dim db as database

set db=currentdb
for each tbl in db.tabledefs
  if instr(tbl.name,"importerrors")>0 then
     db.execute "drop table " & tbl.name
  end if
next

take a copy of your dbs, in case this backfires and deletes all your tables!
 

Users who are viewing this thread

Back
Top Bottom