Results 1 to 4 of 4
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    rename

    Hi all,
    Working in access 2003 database with objects without naming convention. Does anyone know of code or utility to adding a prefix such as tbl to objects? Manually would take such a long time!
    Thanks

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    You could try this but be sure to make a backup of your db first.
    Code:
    Public Sub PrefixTblName()
      Dim t As TableDef
      For Each t In CurrentDb.TableDefs
        If Left(t.Name, 4) <> "MSys" Then
          t.Name = "tbl" & t.Name
        End If
      Next
      
    End Sub
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Your problem could be a lot more involved than that.

    For a start I would do it manually just incase things fail if you use code.

    But you then have to change the table names in any query that you have created.

    I think the trick is to open the query in Datasheet view. Do not go to design view.

    Close the Datasheet view and then save the query. The table names within the queries should update this way, thereby saving a lot of heartache.

    My directions may be a bit off so test it first, or perhaps someone else knows more.

  4. #4
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    This worked. Changed the table names. Will this work with renaming queries and forms? qryName and frmForm???
    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Rename fields and update throughout DB
    By Ojaybee in forum Database Design
    Replies: 1
    Last Post: 09-14-2011, 05:16 PM
  2. rename report and email
    By maddaddy in forum Reports
    Replies: 11
    Last Post: 08-12-2011, 06:17 AM
  3. Copy & Rename a report
    By Juanna_v in forum Reports
    Replies: 25
    Last Post: 02-17-2011, 12:03 PM
  4. rename ole object
    By rbg in forum Access
    Replies: 0
    Last Post: 11-29-2010, 03:13 AM
  5. Transfer SpreadSheet Command and Rename
    By fintan06 in forum Import/Export Data
    Replies: 2
    Last Post: 10-15-2009, 08:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums