Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

How to delete a table?

Discussion in 'Information Technology' started by pokdbz, Jul 28, 2006.

Tags:
  1. pokdbz

    pokdbz
    Expand Collapse
    Guest

    How can I delete a table programaticly?
     
  2. Loading...


  3. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Delete a table, or delete the data that's in a table?

    For the former, you can use:

    CurrentDb.TableDefs.Delete "NameOfTable"

    For the latter, you can use:

    CurrentDb.Execute "DELETE FROM NameOfTable", dbFailOnError

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "pokdbz" <pokdbz@discussions.microsoft.com> wrote in message
    news:C6051535-1A5D-45BB-A33C-4659F38E6DDE@microsoft.com...
    > How can I delete a table programaticly?
     
  4. '69 Camaro

    '69 Camaro
    Expand Collapse
    Guest

  5. pvdg42

    pvdg42
    Expand Collapse
    Guest

    "pokdbz" <pokdbz@discussions.microsoft.com> wrote in message
    news:C6051535-1A5D-45BB-A33C-4659F38E6DDE@microsoft.com...
    > How can I delete a table programaticly?


    Are you trying to remove all rows from the table or get rid of the table
    structure as well?

    To remove all rows (keeping table structure): DELETE FROM <tablename>

    To remove table structure: DROP TABLE <tablename>

    Create the queries, then call them from your app.
     
  6. Steve Schapel

    Steve Schapel
    Expand Collapse
    Guest

    Pokdbz,

    Assuming you mean completely remove the table from the database...
    DoCmd.DeleteObject acTable, "YourTableName"

    --
    Steve Schapel, Microsoft Access MVP

    pokdbz wrote:
    > How can I delete a table programaticly?
     

Share This Page