• Delete tables of error in fields (A2K SR1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Delete tables of error in fields (A2K SR1)

    Author
    Topic
    #379577

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #632556

      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

      • #632770

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

      • #663160

        > dbs.TableDefs.Delete strName

        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

        dbs.TableDefs(strName).delete
        

        Sigh! And Thanks.

        • #663188

          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.

    Viewing 0 reply threads
    Reply To: Delete tables of error in fields (A2K SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: