Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete tables of error in fields (A2K SR1)

    Whenever there was an error in importing data from external sources, for example, the erroneous fields would be saved in one or more tables. After some time, the number of such tables will amount to quite a number. Is there a way to suppress creation of such tables of error? As an alternative, is there a way to delete them from codes (as I will not know the names of the tables)?

    BTW, will such tables of errors be created in a MDE database too?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete tables of error in fields (A2K SR1)

    Import error tables will be created in .mde databases too. The following code will delete *all* tables whose name contains "ImportErrors", so don't use that in you own names. The code uses DAO, so you must have a reference to the Microsoft DAO ... Object Library.

    Sub DeleteImportErrors()
    Dim dbs As DAO.Database
    Dim strName As String
    Dim i As Integer
    Set dbs = CurrentDb
    For i = dbs.TableDefs.Count - 1 To 0 Step -1
    strName = dbs.TableDefs(i).Name
    If strName Like "*ImportErrors*" Then
    dbs.TableDefs.Delete strName
    End If
    Next i
    Set dbs = Nothing
    End Sub

  3. #3
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete tables of error in fields (A2K SR1)

    Thanks HansV for your codes. Look like I have to delete the error tables and I just can't suppress creation of them.

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete tables of error in fields (A2K SR1)

    > <font color=red>dbs.TableDefs.Delete strName</font color=red>

    Hans. Did I put you on the payroll yet?


    I stumbled across your post while trying to find why my expectations weren't realised - again!

    I'd guessed
    <pre>dbs.TableDefs(strName).delete
    </pre>


    Sigh! And Thanks.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Delete tables of error in fields (A2K SR1)

    That's why there are help files that come with the application, Chris. Look up TableDefs, then examine the methods to get the syntax for deleting a tabledef.
    Charlotte

Posting Permissions

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