Rename database Object from another Database

M

Manuelauch

I need to Delete a table and rename other table with the name of the deleted
table. But I wan to do all this from another database using VBA
 
A

Alex Dybenko

Hi,
you can do something like this, air code to show the idea:

dim dbs as database
set dbs=dbengine.opnedatabase ("c:\my.mdb")

dim tdf as tabledef
set tdf=dbs.tabledefs("MyTable")
tdf.name="NewTableName"

dbs.close

and you can use TableDefs.Delete to delete table


--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 
D

Daniel Pineault

To delete a table in an external database, see:

http://www.pcreview.co.uk/forums/thread-3795866.php

You can either create a db connection an then delete it or you can use a
execute query and explicitly define the path to your external db in it, both
are demonstrated in the link provided above.


As for renaming a table, one option (there are others) would be to use the
function found at:

http://www.freevbcode.com/ShowCode.asp?ID=899
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top