By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

Delete table using EXECUTE cmd

P: 2
Hello,

I am new at scripting and having some problems with syntax on EXECUTE cmd

I was traying to reset the primary key on an access db table but I thought it was easier to delete the table and recreate it again.

the following code fails on the last line which is supposed to delete the table. It seems like it is missing a parameter but I am not sure what.

Set cnxAccess = CreateObject("ADODB.Connection")
cnxAccess.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strAccessFile & ";" & _
"Persist Security Info=False"
Set rstAccess = CreateObject("ADODB.Recordset")
cnxAccess.Execute "DELETE TABLE sheet1"

What is wrong with the Execute command?
Thanks,
Kenxo
Jan 31 '08 #1
Share this Question
Share on Google+
2 Replies


QVeen72
Expert 100+
P: 1,445
Hi,

Technically to Remove the table, you have to use the "Drop Table " Command:

cnxAccess.Execute "DROP TABLE sheet1"

All Versions of Oracle Will support the above command.
But for Access , it works only for Version 2007 and Higher .

For Lower Versions you can Use "ADOX"..

Regards
Veena
Jan 31 '08 #2

P: 2
Hi,

Technically to Remove the table, you have to use the "Drop Table " Command:

cnxAccess.Execute "DROP TABLE sheet1"

All Versions of Oracle Will support the above command.
But for Access , it works only for Version 2007 and Higher .

For Lower Versions you can Use "ADOX"..

Regards
Veena
Thanks Veena, the DROP cmd worked.
kenxo
Jan 31 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.