Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete tables (Access 2000)

    I have a function that deletes all tables.i want to modigy the function so as to leave the atble TblCutdate undeleted.How can i do this ?
    Public Function DeleteTables()
    Dim dbs As DAO.Database
    Dim i As Integer
    Set dbs = CurrentDb
    ' Loop backwards through relations
    For i = dbs.Relations.Count - 1 To 0 Step -1
    dbs.Relations.Delete dbs.Relations(i).Name
    Next i
    ' Loop backwards through tabledefs
    For i = dbs.TableDefs.Count - 1 To 0 Step -1
    If Left(dbs.TableDefs(i).Name, 4) <> "MSys" Then
    dbs.TableDefs.Delete dbs.TableDefs(i).Name
    End If
    Next i
    Set dbs = Nothing
    End Function

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

    Re: Delete tables (Access 2000)

    Change

    If Left(dbs.TableDefs(i).Name, 4) <> "MSys" Then

    to

    If Left(dbs.TableDefs(i).Name, 4) <> "MSys" And dbs.TableDefs(i).Name <> "TblCutdate" Then

  3. #3
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete tables (Access 2000)

    Thank you !

Posting Permissions

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