K
Kevin
I am having problems with some DAO code that renames tables by appending a
suffix, that is prompted for. After I supply the suffix to the input box,
only the first table in the array is renamed and then I get a error message.
It is renaming using by using only the suffix and not appending to existing
table name (can't have duplicate table names):
Dim intLoop As Integer
Dim strSuffix As String
Dim varTableNames As Variant
varTableNames = Array("Table1", "Table2", "Table3")
strSuffix = InputBox("What Suffix?", "Rename Table", "")
If Len(strSuffix) > 0 Then
For intLoop = LBound(varTableNames) To UBound(varTableNames)
CurrentDb().TableDefs(varTableNames(intLoop)).Name = _
strTableName & "_" & strSuffix
Next intLoop
End If
suffix, that is prompted for. After I supply the suffix to the input box,
only the first table in the array is renamed and then I get a error message.
It is renaming using by using only the suffix and not appending to existing
table name (can't have duplicate table names):
Dim intLoop As Integer
Dim strSuffix As String
Dim varTableNames As Variant
varTableNames = Array("Table1", "Table2", "Table3")
strSuffix = InputBox("What Suffix?", "Rename Table", "")
If Len(strSuffix) > 0 Then
For intLoop = LBound(varTableNames) To UBound(varTableNames)
CurrentDb().TableDefs(varTableNames(intLoop)).Name = _
strTableName & "_" & strSuffix
Next intLoop
End If