Results 1 to 9 of 9
  1. #1
    mchadwick is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    71

    Deleting Error Tables Automatically


    How do I do it? I want to delete the objects but I dont know how without doing it manually.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Code:
    Dim db As Database
    Dim tdefs As TableDefs, tdef As TableDef
    Dim sTablename as string
    
    Set db = CurrentDb
    For Each tdef In db.TableDefs
         sTableName = tdef.Name
         if instr(sTablename, "SearchString") >0 then
              db.execute "DROP TABLE " & stablename
         endif
    Next tdef
    db.Close
    Set db = Nothing
    You just have to substitute in a partial string from the name of your error tables where SearchString is

  3. #3
    Join Date
    May 2010
    Posts
    339

  4. #4
    mchadwick is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    71
    can I do wildcards? The imports have dates in the names and so the errors have dates in them. Or can I specify the name of the error tables?

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    Do these error table names have a common format/name? Perhaps you could show an example.
    rpeare has given the code required, you could make it a function and call it in a loop, or you could identify the name pattern and process the names directly in a loop.

    Is there any need to identify that you have deleted these tables (audit log)?

  6. #6
    mchadwick is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    71
    I was able to get rid of all the data impacting erros, but the errors im getting now dont seem to be impacting the data. They are "unparsable Record" errors.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    ??? I'm not following exactly what error tables we're talking about?? Can you post an example?
    I don't have Acc2010, I have 2003.

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    My code will drop the automatically generated system tables (ImportError, ImportError2 etc, I forget the naming convention) you just have to put in the correct string and it will delete all of the existing tables with that string when you run the code.

  9. #9
    mchadwick is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    71
    I found a way to just fix the errors coming up. I am no longer getting errors on the DB.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Deleting error tables
    By bcurrey in forum Programming
    Replies: 3
    Last Post: 08-23-2011, 05:39 PM
  2. Deleting Tables With Wildcard?
    By orcinus in forum Programming
    Replies: 2
    Last Post: 06-20-2011, 10:48 AM
  3. Replies: 11
    Last Post: 12-14-2010, 01:25 PM
  4. Automatically Adding New Data to Tables
    By aquarius in forum Import/Export Data
    Replies: 1
    Last Post: 09-15-2010, 07:27 PM
  5. Error when deleting a record
    By access in forum Forms
    Replies: 5
    Last Post: 06-15-2009, 12:33 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums