Access: Remove “dbo_” prefix from imported tables

The procedure below 1, can be used to remove the “dbo_” prefix from all imported tables within a Microsoft Access Database.

Public Sub Remove_DBO_Prefix()
 
    Dim obj As AccessObject
    Dim dbs As Object
 
    Set dbs = Application.CurrentData
 
    'Search for open AccessObject objects in AllTables collection.
    For Each obj In dbs.AllTables
 
        'If found, remove prefix
        If Left(obj.Name, 4) = "dbo_" Then
            DoCmd.Rename Mid(obj.Name, 5), acTable, obj.Name
        End If
 
    Next obj
 
End Sub
  1. Please ensure you test any script taken from my website on a test/development machine, before running on a production server.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.