Deleting an Access Table VBA

B

Boss Spearman

I'm trying to delete an access table from Excel.
When I try and delete the table using VBA this message appears:
"Cannot delete this index or table. It is either the current index or
is used in a relationship."
But there is no relationship with this table.
I can delete the table in access with no problem but I need to do it in
VBA.

I have tried to delete the tables by using these two methods.

strSQL = "DROP TABLE tblPrices;"
cnnX.Execute strSQL

vtSql = "DROP TABLE tblPrices"
cmd.CommandText = vtSql
cmd.Execute

Thanks
 
C

Cindy M.

Hi Boss,

I recommend you ask this in an ACCESS forum, where you'll find the Access
specialists. Be sure to mention the version of Office you're working
with, and what methods you're trying to use (looks like ADO? Which
version?) And show more of the code (connection to the DB)
I'm trying to delete an access table from Excel.
When I try and delete the table using VBA this message appears:
"Cannot delete this index or table. It is either the current index or
is used in a relationship."
But there is no relationship with this table.
I can delete the table in access with no problem but I need to do it in
VBA.

I have tried to delete the tables by using these two methods.

strSQL = "DROP TABLE tblPrices;"
cnnX.Execute strSQL

vtSql = "DROP TABLE tblPrices"
cmd.CommandText = vtSql
cmd.Execute

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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