Results 1 to 6 of 6
  1. #1
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568

    Replacing tables name within queries

    Hi Guys,

    i am using linked tables and when i am changing it within BE (postgresql) i have problem with queries.
    I have to go for each of query and replace table name for new one.

    It is a way to do it in easy way? No manually?

    Best,
    Jacek

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Can you tell us why you have to replace table name for new one?

  3. #3
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Hi orange,

    ok:

    I have table t_clients and this is linked table.

    I am changing its name to t_customers.

    So i have to refresh linked table and refresh queries with this table.

    Best,
    Jacek

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Jacek,

    Not sure why you need to rename the table, but you could try to see if turning the Name AutoCorrect on and renaming the table first will work for you. So what I propose is to have the first table (t_clients) in Postgre be, then rename the t_clients in the front-end to t_customers (at which point NameAutocorrect should update all the object relationships) and only after that rename it in the back-end and refresh the links. Name Autocorrect was historically a very messy feature that most people had disabled (me included), but lately I found it was working in cases like you describe (I would turn it back off after you use it).

    Cheers,
    Vlad

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,979
    Gicu's solution should work fine for queries but won't alter VBA code

    In all, you need to do three things:
    1. In the VBE, search & replace all instances of tblClients with tblCustomers

    2. Now go to Database Tools ... Object Dependences
    Select tblClients and click Objects that depend on me to get a list of all quries that include that table
    Then edit the SQL manually
    OR do that part as Gicu has suggested

    3. Check any macros if you use them

    OR if that's likely to take a long time, I suggest you download the free Access add-in, V-Tools, which includes a deep search & replace feature which works well
    The only thing it cannot alter are macros
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #6
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    Thank you Guys !!

    Fortunately in my model changing SQL manually was short task.
    But for the future i will use your tips and advices.

    Best Wishes,
    Jacek

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

Similar Threads

  1. Tile Tables, Queries etc
    By bruegel in forum Access
    Replies: 2
    Last Post: 03-28-2018, 07:30 AM
  2. Replies: 5
    Last Post: 06-05-2016, 09:23 PM
  3. Linking 2 Tables or Queries
    By vdanelia in forum Database Design
    Replies: 4
    Last Post: 03-01-2011, 03:07 PM
  4. Getting Info From Tables with Queries
    By SteveI in forum Queries
    Replies: 0
    Last Post: 03-01-2010, 08:33 AM
  5. queries or tables?
    By ejohns in forum Reports
    Replies: 7
    Last Post: 07-27-2009, 11:31 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