Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Sep 2005
    Thanked 0 Times in 0 Posts
    I have one database that links to SharePoint lists stored on many different workspaces. Each of the workspaces is identically created, so that each space has lists named "Products," "Customers." "Regions", etc. The field names in each table are identical.

    When I link to the lists with Access, my table structure becomes "Products" "Products1" "Products2"

    Is there a way to programmatically change the names of the tables, allowing me to have more meaningful names? I'd like to be able to have "Products_PA" "Products_OH" "Products_NY" so that I don't need to continually use an off-line list to know which table I'm working with.

    I know that I can do this manually using 'rename' on each linked table, but there are so many that it would be worth while to be able to write the code and, by passing a parameter, have the identifier added as a suffix to the newly added table names.

    The table MSysObjects seems to be read only, and I can't figure out how to run a query against it; nor do I know the code to use to get to the name property.

    Any ideas?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts
    The syntax to rename a table is

    DoCmd.Rename "tblNew", acTable, "tblOld"

    Note that the new name is the first argument and the old name the last argument.

    You can, of course, use variables or expressions instead of "tblNew" and "tblOld".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts