"Joe" <(E-Mail Removed)> wrote in message
news:2729b01c4635e$5c89b1e0$(E-Mail Removed)
> Hello All:
> I'm looking to create a list of all of the tables in a
> dB. I would like to edit this list using the rename
> method. My goal is simply to rename all of the tables in
> bulk. I only need to remove a prefix from each table.
> Thanks in advance for any help.
> Joe
Code along these lines should do it:
'----- start of procedure -----
Sub RemoveTablePrefix(strPrefix As String)
Dim db As DAO.Database
Dim tdf As DAO.TableDef
If strPrefix = "MSys" Then
Msgbox "You may not rename system tables!"
Exit Sub
End If
Set db = CurrentDb
For Each tdf In db.TableDefs
If tdf.Name Like strPrefix & "*?" Then
tdf.Name = Mid(tdf.Name, Len(strPrefix) + 1)
End If
Next tdf
Set db = Nothing
Application.RefreshDatabaseWindow
End Sub
'----- end of procedure -----
You'd call it like this:
RemoveTablePrefix "xxx"
(where "xxx" is the prefix to be removed).
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)