Hi Guys,
I'm trying to change the names of 3 tables with the following code but I'm getting this error message "Item not found in this collection"
Option Compare Database
Option Explicit
Function RenameTables()
Dim db As DAO.Database
Set db = CurrentDb
Debug.Print
db.TableDefs("EmpDep_Old").Name = "Empdep_Archive"
db.TableDefs("EmpDep_New").Name = "Empdep_Old"
db.TableDefs("EmpDep_New_Temp").Name = "Empdep_New"
Set db = Nothing
End Function
I think I have the correct references ticked so I'm not sure where I've gone wrong.
Thanks in advance.
I'm trying to change the names of 3 tables with the following code but I'm getting this error message "Item not found in this collection"
Option Compare Database
Option Explicit
Function RenameTables()
Dim db As DAO.Database
Set db = CurrentDb
Debug.Print
db.TableDefs("EmpDep_Old").Name = "Empdep_Archive"
db.TableDefs("EmpDep_New").Name = "Empdep_Old"
db.TableDefs("EmpDep_New_Temp").Name = "Empdep_New"
Set db = Nothing
End Function
I think I have the correct references ticked so I'm not sure where I've gone wrong.
Thanks in advance.