Rename database Object from another Database

  • Thread starter Thread starter Manuelauch
  • Start date Start date
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
 
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
 
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.
 
Back
Top