Results 1 to 2 of 2
  1. #1
    NewAtThis is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    1

    Using results of a Queries to perform the calculations in another Query

    Hello all,



    I did see this question asked in 2010 (kind of). Here goes again. I am absolutely new to access and first time post, bear with me.

    CP= sum[D_Act]-sum[PU] Where: [D_Act] = sum[S_Num]+sum[D_E]

    and

    D_E= 100-[CP_Last]-[PU_Last] Where: CP_Last = last value in CP of specified customer and PU_Last = last value in PU of specified customer.

    I have created a query ( Query_A) which calculates the following fields:

    sum[PU], [PU_Last], sum[S_Num]


    1. The problem occures when I try to calculate CP or D_E. because they rely on each other, I need to calculate CP first, and then calculate D_E from the results of my initial CP calculation. Please help me understand how I can daisy chain my queries together to set the order they will be executed. I would force the query calculating CP first and then the calculation of D_E would occur based on the last value of CP and PU. I would use the append query to keep a record of the CP caluclations and the D_E calculation. I know I should not store calculated values; however because my equations are recursive they need previously data to predict current events ie. D_E.

    2. In creating the query mentioned above Query_A; I have created several queries to created the component fields ie. sum[PU], [PU_Last], sum[S_Num]. Will running Query_A automaticall execute queries associated with the fields within Query_A? I will check this myself tonight. If it does not, is there a way to execute Query_A and all quries which were used to make Query_A? They are a bit of the same question which is why I have them both listed. If I can automaticall execute a string of queries in a determined order, My question for both would be answered.

    Thanks in Advance.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can base query B on query A instead of (or in addition to) a table. Running query B will automatically run query A in the background.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 6
    Last Post: 05-12-2012, 03:13 AM
  2. Query to perform percentage
    By mari_hitz in forum Queries
    Replies: 4
    Last Post: 04-10-2012, 10:56 AM
  3. Query to perform several special operations
    By Allison in forum Queries
    Replies: 4
    Last Post: 05-13-2011, 04:30 PM
  4. Replies: 2
    Last Post: 04-18-2011, 02:46 PM
  5. Replies: 3
    Last Post: 05-21-2010, 03:57 PM

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