T Tintin via AccessMonster.com Feb 5, 2007 #1 Can I rename TableName at db1 from db2? If yes please help me with the code. Thanks Tintin
G Graham R Seach Feb 5, 2007 #2 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
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
T Tintin via AccessMonster.com Feb 6, 2007 #3 Dear Graham, Thank you Sir, the code works perfectly. Regards, Tintin