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

Programatically deleting Tables 1

Status
Not open for further replies.

Scoty

Programmer
Oct 25, 2000
278
US
I am creating a program that will create a new (temp) table everyday. I would like to delete yesterdays table before I make today.
Any Ideas
Thanks
Scoty ::) "Learn from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),
 
Method 1:
Code:
    CurrentDb.Execute "DROP TABLE " & strTableName

Method 2:
Code:
    CurrentDb.TableDefs(strTableName).Delete

Take your pick. Rick Sprague
 
Once again Sir. I thank you.
::) "Learn from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),
 
You can try :
dbs.Execute "DROP TABLE [YESTERDAY_TABLE];"

But if you don´t want to delete the "yesterday-table" you can use "today-table" overwriting itself every day with a SELECT..INTO sentence.

DoCmd.SetWarnings False
'** Don´t ask : Overwrite existing table ?
DoCmd.RunSQL "SELECT * INTO [TODAY_TABLE] FROM [TABLE OR QUERY]"

IT'S ONLY ONE DIFFERENT IDEA !
 
I need a module that will delete all those annoying import error tables
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top