[AccessD] A2003 :Rename tables

vchas at comcast.net vchas at comcast.net
Thu Mar 30 16:18:59 CST 2006


Hi Darren.,
This should do the trick.
Function dbo_Remover() As Integer
' Use this module remove the linked table start name dbo_
'Dim db As Database
Dim i As Integer
Dim c As Long
c = 0
Set db = DBEngine.Workspaces(0).Databases(0)
dbo_Remover = False
db.TableDefs.Refresh
For i = 0 To db.TableDefs.Count - 1
If (Left(db.TableDefs(i).Name, 4) = "DBO_") Then
'MsgBox "found " & db.TableDefs(i).Name
db.TableDefs(i).Name = Mid(db.TableDefs(i).Name, 5)
c = c + 1
'MsgBox "new name = " & db.TableDefs(i).Name
End If
Next i
Set db = Nothing
MsgBox "dbo_ Removed From " & c & " Filenames....."
End Function
Vinnie Chas
www.vinniechas.com
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren DICK
> Sent: Thursday, March 30, 2006 1:34 PM
> To: 'Access Developers discussion and problem solving'
> Subject: [AccessD] A2003 :Rename tables
> 
> Hi all
> I have a zillion tables all prefixed with dbo.
> Does anyone have a loop for the TableDef to rename or remove 
> the dbo bit?
> 
> Many thanks
> 
> Darren
> --
>


More information about the AccessD mailing list