Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Dec 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing the table for fields in a Query (2003)

    I have a query and I have previously selected only a few of the fields that I need from a huge table with tons of fields for this query. Now, a month later , I am going to use this query but I need a more current table which I have just imported into my database. I add this new table using "Show Table" but my query is looking at the prior table. I then have to go into the table line of each field in my query (at the bottom of half of my screen) and tell it to now look at my new table. This requires me to do it each field at a time. I was wondering if I could change the table the query needs to look at in each field in one step instead of going to each field and clicking the down arrow and choosing the new table. I don't want to bring the fields in from the new table all over again because then I would have to determine all over again which ones I wanted.

    I would appreciate any help! Thanks!

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

    Re: Changing the table for fields in a Query (2003)

    Open the query in design form.
    Remove the new table if you saved the query with the new table.
    Click on the old table in the upper section of the query design window.
    Activate the Properties window (View | Properties if it isn't visible).
    Specify a short alias for the table, e.g. T.
    Select View | SQL.
    You will see something resembling

    SELECT T.Field1, T.Field2, ...
    FROM [NameOfOldTable] As T
    ...

    Replace the name of the old table with that of the new one. Because of the alias, you only have to do it in one place, after the FROM.
    Select View | Design View.

  3. #3
    New Lounger
    Join Date
    Dec 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Changing the table for fields in a Query (2003)

    You are awesome! Thanks for your help!

Posting Permissions

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