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

Deleteing a table in an Access 2000 database

Status
Not open for further replies.

NobleDBell

Programmer
Jul 28, 2003
7
US
How is the best way to delete a table in a Microsoft Access 2000 database in code? I need to be able to do this in an application that I am working on.

I want to delete a table in code and then re-create the table and populate it with records from another table.

Thanks in advance,


---------------------------------------
Noble D. Bell
 
Try the SQL 'Drop' statement

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 

Is this a one-time-thing, or will it be done more often with the same table?
Will multiple users be accessing the db at the same time?

You might be better off just emptying the table:
conn.Execute "DELETE * FROM TheTable",Options:=adCmdText Or adExecuteNoRecords

and then filling the table with the new data:

conn.Execute "INSERT INTO TheTable SELECT * FROM SomeOtherTable",Options:=adCmdText Or adExecuteNoRecords

If this is a temp table then I would suggest using a temp mdb to store/delete the data in order to keep the main mdb from bloating:

conn.Execute "INSERT INTO [C:\Other.MDB].TheTable SELECT * FROM SomeOtherTableInCurrentMDB",Options:=adCmdText Or adExecuteNoRecords
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top