Results 1 to 5 of 5
  1. #1

    Clearing a table (Access 97)

    This may be a really stuid question but I do not know how to do it. I have a program that is opening sequential files (000001.csv,000002.csv,etc.), and each linking these files to one Table in Access. However, the TransferText command (used in order to import the data from the file to the table) appends the data that is already in the file after each file is complete. I need a way to clear the contents of the table before opening the next file- can someone please help- Thanks in advance!!!

  2. #2

    Re: Clearing a table (Access 97)

    If you're looking to clear the target table, you could run a bit of code like:

    Function ClearMyTable()
    Dim db As Database
    On error Resume Next
    Set db = CurrentDb
    db.Execute "DELETE * FROM MyTable;"
    End Function

    Of course you would replace 'MyTable' with the actual name of the table. If you want this in a macro, use the RunSQL command and use "DELETE * FROM MyTable;" as your SQL statement.

  3. #3

    Re: Clearing a table (Access 97)

    Thank you for the help

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Clearing a table (Access 97)

    Are you saying that you append records to a table from a file and then you delete those records and append records from a different file? Is there a reason for that?

  5. #5

    Re: Clearing a table (Access 97)

    In each of the files(which is a csv file) there are anywhere between 1 and 50 rows of data. Out of all those rows I only need to find one number (the man in a certain column)- But I have 2500 files to work with and I need to do this for every one, so if I need to delete the data before the next entry is appended because I need to run a query on only one file of data at a time.- Does that expain(HopefullY)!!!

Posting Permissions

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