General discussion

  • Creator
    Topic
  • #2076790

    Renaming A Table

    Locked

    by mra2 ·

    Does anyone know how to rename a table using MS Access 97 VBA????

    Thanks!

All Comments

  • Author
    Replies
    • #3787701

      Renaming A Table

      by roc180 ·

      In reply to Renaming A Table

      Use the provided function

      ‘****************************
      ‘Use for testing
      Sub Test_ChangeName()
      MsgBox _
      Change_TableName(“Tbl_1”, “Tbl_NewName”)
      End Sub

      ‘*****************************************
      ‘Function finds TBL(strOldTBL_Name)and
      ‘changes name to new name (strNewTBL_Name)

      Function Change_TableName(strOldTBL_Name As String, strNewTBL_Name As String) As Boolean

      Dim TdfChange As TableDef
      Dim boolChange As Boolean

      With CurrentDb
      For Each TdfChange In .TableDefs
      If TdfChange.Name = strOldTBL_Name Then
      TdfChange.Name = strNewTBL_Name
      boolChange = True
      End If
      Next TdfChange

      If boolChange Then
      .TableDefs.Refresh
      End If
      End With

      Change_TableName = boolChange
      End Function

      Good Luck
      Neal Martinelli

      • #3787833

        Renaming A Table

        by mra2 ·

        In reply to Renaming A Table

        Poster rated this answer

    • #3787832

      Renaming A Table

      by mra2 ·

      In reply to Renaming A Table

      This question was closed by the author

Viewing 1 reply thread