+ Reply to Thread
Results 1 to 6 of 6

Adding A Field To A Query

  1. #1
    Registered User
    Join Date
    05-20-2009
    Location
    Atlanta, GA
    MS-Off Ver
    Office 365
    Posts
    60

    Adding A Field To A Query

    Hello,

    I have imported several data tables into Excel for each period over the last couple years. I have two union queries for Trailing Twelve Month (TTM) periods, Current TTM and Previous TTM. What I would do now, is create a query from my union query making an exact copy. I do this because I cant use a union query as an external data source for a pivot table in Excel, which I use to report out on all this data.

    Now here is problem, I would like to add a "TTM" field into each of these queries, so I can label each record as "Current" in the Current TTM query or "Previous" in the Previous TTM query. Suggestions? Please let me know if I have been too vague.

    Thanks,

    Keith

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Adding A Field To A Query

    just add a new field in query design using
    TTM: "Current"
    and repeat for the other query then add TTM to the union query field list.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    05-20-2009
    Location
    Atlanta, GA
    MS-Off Ver
    Office 365
    Posts
    60

    Re: Adding A Field To A Query

    JosephP,

    I tried to do just that on Friday. I am very new to Access so I must have missed something very simple. I added a field named TTM, and I didn't know how to assign a value to all the records. I tried making the Default Value = "Current," but the records all still came in blank. Could you please guide me through exactly what you are suggesting? I think this is exactly what I need.

    Thanks,

    Keith

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Adding A Field To A Query

    in Query Design View add a new field and in the Field: row enter:
    TTM: "Current"

    and save. repeat for the other query but replace Current with "Previous" and save that. Then just add the TTM field into the UNION query as you did the other fields.

  5. #5
    Registered User
    Join Date
    05-20-2009
    Location
    Atlanta, GA
    MS-Off Ver
    Office 365
    Posts
    60

    Re: Adding A Field To A Query

    JosephP,

    Thank you very much. That worked! Now I can run a union query to combined the two TTM's, and use it in a pivot table in Excel. I continue to learn and make use of this thing called Access.

    Keith

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Adding A Field To A Query

    Yeah, it's one of the better Excel add-ins. ;-)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1