Results 1 to 7 of 7
  1. #1
    mfearer94 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    21

    Question Is this possible? Using calculation fields from one query in another query.

    Alright so I'm going to make this basic since I just want to know if this is possible.

    You have some fields in your main data table, i.e. Customer, Price 1, Price 2...
    You then call upon that information by a select query (Query 1) and create new fields inside the query using calculations i.e. "SubTotal:[Price 1]+[Price 2]"
    Now I want to call upon the field [SubTotal] by Query 2 and use that in another calculation. i.e. "Total:[SubTotal 1]+[SubTotal 2]"


    I'm guessing this isn't possible since the field isn't stored anywhere, but if it is, please tell me how to call upon that field in a query and if not, how you would get around this.
    Thanks in advance.

  2. #2
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    mfearer94 -

    If I understand your situation correctly, yes, this is possible. The second query would be based upon the first - so, all fields in the first query would be available in the second.

    All the best,

    Jim

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Yes, you can do that. I have many queries like that.

    Have you tried creating Query2 based on Query1? (Query1 is, in effect, a virtual table.)

    Post back if you have problems....

  4. #4
    mfearer94 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    21
    Thanks for your response Jim. That would work, but I actually want to have my final query pull in many calculated fields from many different queries, about 4 to be exact.

    I read something about a union query which I haven't worked at all with. Could that help? Thanks again.

  5. #5
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    mfearer94 -

    A Union query might be a possibility. Other forum members would be better qualified to help you with them as I have very limited experience using them.

    However, if you can provide the table names where the raw data resides, the field names used in each of the calculations and the calculations themselves as well as any existing relationship between the tables, there might be other possibilities.

    All the best,

    Jim

  6. #6
    mfearer94 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    21
    Thanks again Jim,

    I believe I came up with an idea even though it's not pretty at all.
    I'm going to create update queries based upon each query. Then I will update a larger calculation table which then I can use in the final large calculation query.
    Like I said, it's definitely not pretty, but I think it might work.

    Thanks for the help though.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you want to UNION and not JOIN records, no need to write over to another table. A UNION query is not really that difficult. I do wonder why you have 4 separate datasets that require UNION. If these 4 queries all use the same datasource and do the same calcs, why not just 1 query to begin with? Maybe you need to build an aggregate GROUP BY (Totals) query or build a report that uses Grouping & Sorting with aggregte calcs. The report will allow display of detail records as well as summary calcs.

    Post the sql statements of the 4 queries for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Calculation Field in table vs Query calculation
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 02-28-2013, 09:38 PM
  2. Query Calculation
    By Rhubie in forum Queries
    Replies: 4
    Last Post: 02-01-2013, 12:35 PM
  3. Query Calculation
    By Rhubie in forum Access
    Replies: 3
    Last Post: 08-28-2012, 01:41 PM
  4. calculation in a query
    By funi.t in forum Reports
    Replies: 5
    Last Post: 01-25-2012, 05:24 AM
  5. Query calculation
    By Charter in forum Queries
    Replies: 8
    Last Post: 12-30-2011, 11:50 AM

Tags for this Thread

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