Tony wrote:
G'day, How can I DROP a table from an external database (mdb) use vba code?
Drop the link by using:
CurrentDb.Execute "drop table MyTable", dbFailOnError
Drop from another db by...
(air code)
Dim db as dao.database
set db = dbengine(0).opendatabase("MyExternalDb.mdb")
db.execute "drop table MyTable", dbFailOnError
db.close
set db=nothing
Notes:
You need a reference to DAO.
Won't let you drop a table referenced by foreign keys.
You can use ADO but will need to set a connection string, I easily
forget all the bumf that goes into ADO connection strings so I generally
use a DSN, which makes the code a bit more flexible if compiled (in VB)
or made into an MDE (in Access).
--
Pretentious? Moi?