• Delete tables (Access 2000)

    • This topic has 2 replies, 2 voices, and was last updated 18 years ago.
    Author
    Topic
    #441933

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1062466

      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

    Viewing 0 reply threads
    Reply To: Delete tables (Access 2000)

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

    Your information: