473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Delete table using EXECUTE cmd

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
2 2110
QVeen72
1,445 Expert 1GB
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
Kenxo
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

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

Similar topics

1
by: Dom | last post by:
Hey there, I would like to execute the following query to perform deletes. Unfortunately it only returns a list of the delete queries without actually performing them. How can I get the deletes...
14
by: sdowney717 | last post by:
Using the the NumId from TitleData, I would like to delete the corresponding row in Bookdata using pure SQL. I want it to delete all rows in bookdata where the Titledata.NumID is a match to...
3
by: James A | last post by:
I've been searching around for a while now trying to find how I can delete a table through vb. I'm using access2000. I use this to make a table: CurrentDb.Execute "CREATE TABLE " &...
2
by: ms | last post by:
Access 2000: I am trying to delete duplicate records imported to a staging table leaving one of the duplicates to be imported into the live table. A unique record is based on a composite key of 3...
2
by: Dave Burt | last post by:
Hi, Access officionados, I'm new here, so please cut me slack/gently tell me off if I'm out of line or in the wrong place. OK, here's something that seems silly (and is also problematic to...
3
by: Tim Marshall | last post by:
HI all, Access 2003, Jet back end. Rather than annoy my users in a particular app by having relationships with enforced relational integrity refuse to delete a record with related records, I'm...
6
by: Ivan | last post by:
Hello to all and thanks for answer to my topics. I made one stored procedure that delete one table, but when call/execute the procedure this show SQL0532N A parent row cannot be deleted...
1
by: SteveBark | last post by:
Hello all I am currently trying to develop a script that will take a value from an Excel spreadsheet cell and use that to run a query against an Access table to delete all rows that match the...
8
by: ananthaisin | last post by:
How to reduce the table size for any table while using truncate or delete statements. In oracle 8i it was truncating the storage space but in 10g it is not .... I have given truncate statement in...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.