Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Location
    Staffs, England
    Posts
    18

    Question Unanswered: clearing a table

    whats the best and easiest way to clear all records from a table using VBA?

    Dion

  2. #2
    Join Date
    Jan 2003
    Location
    Aberdeen, Scotland, UK
    Posts
    168

    Re: clearing a table

    Dim Db as database
    Dim Rs as recordset

    Set db = currentdb()
    set rs = "select * from [yourtable]"

    while not rs.eof
    rs.edit
    rs.delete
    rs.update
    wend

    ------------
    or use a delete query:

    docmd.runquery "nameofdeletequery"
    J.

  3. #3
    Join Date
    Feb 2003
    Location
    Staffs, England
    Posts
    18
    cheers!

  4. #4
    Join Date
    Apr 2002
    Posts
    139
    Alternative:

    DoCmd.RunSQL "DELETE YourTable.* FROM YourTable;"

    Saves you storing a delete query as an object in the db :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •