Rename TableName at db1 from db2

  • Thread starter Thread starter Tintin via AccessMonster.com
  • Start date Start date
T

Tintin via AccessMonster.com

Can I rename TableName at db1 from db2? If yes please help me with the code.

Thanks
Tintin
 
Tintin,

Public Sub ChangeRemoteTableName( _
strOldTableName As String, _
strNewTableName As String, _
strFilespec As String)

Dim db As Database
Dim tdf As DAO.TableDef

'Open the remote database
Set db = OpenDatabase(strFilespec)

'Get a reference to the existing remote table
Set tdf = db.TableDefs(strOldTableName)

'Rename the table
tdf.Name = strNewTableName

'Clean up
Set tdf = Nothing
Set db = Nothing
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Dear Graham,

Thank you Sir, the code works perfectly.

Regards,
Tintin
 
Back
Top