Renaming A Table
Does anyone know how to rename a table using MS Access 97 VBA????
Thanks!
Web Development
Does anyone know how to rename a table using MS Access 97 VBA????
Thanks!
by roc180
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
by mra2
by mra2
This discussion is closed to new replies.
Sort by Trending