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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete tables whose names end in 1

Status
Not open for further replies.

eti3nne

MIS
Feb 5, 2004
102
I have imported what is effectively a duplicate set of tables etc. from one db to another. All the imported objects (where duplicate names) are suffixed with a 1 as expected.

How can I delete all tables whose names end in a 1, via code.

Thanks for looking.
 
run this code
Code:
dim rst as recordset
set rst =currentdb.openrecordset "SELECT MSysObjects.Name as tablename FROM MSysObjects
WHERE MSysObjects.Type=1 and right(name,1)='1'"
with rst
do while not .eof
currentdb.execute "drop table " & !tablename
.movenext
loop
end with
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top