Using VB to delete table in another database

sphere_monk

Registered User.
Local time
Today, 07:56
Joined
Nov 18, 2002
Messages
62
Is it possible to use VB to delete a table in a different database?

I have one database(DB1) (the database the code resides in) that needs to take tables from a second database(DB2) and (periodically) copy them into a third database(DB3). I am planning to create a form with a command button that performs the following steps to accomplish this:

  1. Import the tables as temp tables from the DB2 into DB1 using DoCmd.TransferDatabase acImport.
  2. Copy the tables from DB1 into DB3 using DoCmd.CopyObject.
  3. Delete the temp tables from step 1, using DoCmd.DeleteObject.

The problem that I see is that at step 2, if the table in DB3 already exists, then DoCmd.CopyObject will put a (1) at the end of the tablename. I need to get rid of the old table in DB3 first.

Does anyone know of a way to do this from DB1?

Any help would be appreciated.
 
Thanks, Bob, especially for the speedy reply.

I'll take a look at the code. It sounds like exactly what I need.
 

Users who are viewing this thread

Back
Top Bottom