Getting rid of dbo_ in tables names of linked tables

G

Guest

Heres a useful VBA script to get rid of the dbo_ in names of linked tables:
----------------------------------------------------------------------------------------------
Option Compare Database
Sub RenameTables()
'Make sure you add a Reference to Microsoft DAO 3.6
'Click Tools->References and Check Microsoft DAO 3.6 Object Library
Dim Db As DAO.Database
Dim Tbl As DAO.TableDef

Set Db = CurrentDb

For Each Tbl In Db.TableDefs
If Left(Tbl.Name, 4) = "dbo_" Then
Tbl.Name = Right(Tbl.Name, Len(Tbl.Name) - 4)
End If
Next

End Sub
 
B

Buddy

Shorter

Sub RenameTables
Dim vo_tdf As TableDef
For Each vo_tdf In CurrentDb.TableDefs
If Left(vo_tdg.Name, 4) = "dbo_" Then vo_tdf.Name = Mid(vo_tdf.Name, 5)
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top