Paul Hartland (ISHARP)
paul.hartland at isharp.co.uk
Wed Aug 31 10:35:49 CDT 2005
Karen, Sorry, mis-counted replace : For i = 0 To db.TableDefs.Count - 1 If (Left(db.TableDefs(i).Name, 10) = "NIOSH\get3_") Then 'MsgBox "found " & db.TableDefs(i).Name db.TableDefs(i).Name = Mid(db.TableDefs(i).Name, 11) c = c + 1 'MsgBox "new name = " & db.TableDefs(i).Name End If Next i With For i = 0 To db.TableDefs.Count - 1 If (Left(db.TableDefs(i).Name, 11) = "NIOSH\get3_") Then 'MsgBox "found " & db.TableDefs(i).Name db.TableDefs(i).Name = Mid(db.TableDefs(i).Name, 12) c = c + 1 'MsgBox "new name = " & db.TableDefs(i).Name End If Next i Paul Hartland Database Developer 07730 523179 -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Paul Hartland (ISHARP) Sent: 31 August 2005 16:30 To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Renaming SQL Tables Karen, This is a quick little function I use: 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, 10) = "NIOSH\get3_") Then 'MsgBox "found " & db.TableDefs(i).Name db.TableDefs(i).Name = Mid(db.TableDefs(i).Name, 11) c = c + 1 'MsgBox "new name = " & db.TableDefs(i).Name End If Next i Set db = Nothing MsgBox "NIOSH\get3_ Removed From " & c & " Filenames....." End Function Paul Hartland Database Developer 07730 523179 -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Nicholson, Karen Sent: 31 August 2005 16:18 To: Access Developers discussion and problem solving Subject: [AccessD] Renaming SQL Tables I just linked to about 150 SQL tables; of course all are prefaced with NIOSH\get3_ I want to strip off the prefix. Does anybody have that code? I know I have seen it somewhere. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com