Change Table Names with Code

  • Thread starter Thread starter SAC
  • Start date Start date
S

SAC

I've linked table to a sql server and they now all have dbo_ in front of the
names.

How can I iterate through all the table names and remove the dbo_?

Thanks for your help!!
 
Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef

Set dbCurr = CurrentDb()
For Each tdfCurr In dbCurr.TableDefs
If Left$(tdfCurr.Name, 4) = "dbo_" Then
tdfCurr.Name = Mid$(tdfCurr.Name, 5)
End If
Next tdfCurr

Set tdfCurr = Nothing
Set dbCurr = Nothing
 
Back
Top