Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Swap Tables (Access 2003)

    I want to swap tables in a Query. The fields in both tables have exactly the same name, but I don't want to delete the table and start from scratch. I thought changing the alias name of the table would work, but it doesn't. Is there a way of doing it?

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Swap Tables (Access 2003)

    You have already made an alias for the table -- suppose it is "TBL"

    If you view the query in SQL view, you will find a portion that says something like FROM myTbl AS TBL Simply edit it to read FROM myOtherTbl AS TBL
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Swap Tables (Access 2003)

    1. Give the table an alias, for example T.
    2. Switch to SQL view. The name of the table will only occur once in the SQL string, e.g.

    SELECT T.ThisField, T.ThatField, ... FROM TableName AS T
    WHERE ((T.OtherField) = 0)

    3. Change the single occurrence of the table name.
    4. Switch back to design view.
    5. Close and save the query.

    Note: without the alias, you'd have to change the table name in a lot of places.

  4. #4
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Swap Tables (Access 2003)

    Thanks both. I'm having other problems with my system at the moment so I'll have to try it later. Thanks.

Posting Permissions

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