Delete table using EXECUTE cmd

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kenxo
    New Member
    • Jan 2008
    • 2

    Delete table using EXECUTE cmd

    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("A DODB.Connection ")
    cnxAccess.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
    "Data Source=" & strAccessFile & ";" & _
    "Persist Security Info=False"
    Set rstAccess = CreateObject("A DODB.Recordset" )
    cnxAccess.Execu te "DELETE TABLE sheet1"

    What is wrong with the Execute command?
    Thanks,
    Kenxo
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

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

    cnxAccess.Execu te "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

    Comment

    • Kenxo
      New Member
      • Jan 2008
      • 2

      #3
      Originally posted by QVeen72
      Hi,

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

      cnxAccess.Execu te "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

      Comment

      Working...