Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2006
    Posts
    43

    Unanswered: Iím trying to run a query from within a query(But Run One Last)

    Iím trying to run a query from within a query "But Run it Last".

    Basically Iím wondering if I can run a query or sql in a order so that all filters and formulas in a query will run, but before itís finished it will look at the last formula

    This is the statement I would like to run at the end, after all the filters and stuff has run. If you know that this is something I canít do for, please let me know that also and I will move on and try something different

    this is the statment I would like to run last:
    [sql]Master_Table_Join_to_Peer_Groups_tbl.[Past_12_Months$], Master_Table_Join_to_Peer_Groups_tbl.[Past_12_Months#], 1+DCount("*","([Master_Table_Join_to_Peer_Groups_tbl])","([Past_3_Month#])<" & ([Past_3_Month#])) AS 3Rank
    [/sql]

    [sql]
    SELECT Master_Table_Join_to_Peer_Groups_tbl.[OMNI Number], Master_Table_Join_to_Peer_Groups_tbl.[LAST FINANCIALS RCVD], Master_Table_Join_to_Peer_Groups_tbl.[NET WORTH OF LAST FINANCIALS RCVD], Master_Table_Join_to_Peer_Groups_tbl.[Fiscal Report Date], Master_Table_Join_to_Peer_Groups_tbl.[NEXT RE-CERT LTR], Master_Table_Join_to_Peer_Groups_tbl.[US Bank -VA Sponsor], Master_Table_Join_to_Peer_Groups_tbl.[VA AUTO APPROVED], Master_Table_Join_to_Peer_Groups_tbl.[US Bank - Authorized Agent Relationship], Master_Table_Join_to_Peer_Groups_tbl.[FHA DE APPROVED], Master_Table_Join_to_Peer_Groups_tbl.[CONV DELEGATED APPROVAL DATE], Master_Table_Join_to_Peer_Groups_tbl.[CONV DELEGATED "TIER"], Master_Table_Join_to_Peer_Groups_tbl.[Easy D Approved], Master_Table_Join_to_Peer_Groups_tbl.[Easy D Lite], Master_Table_Join_to_Peer_Groups_tbl.[BRANCH #], Master_Table_Join_to_Peer_Groups_tbl.FUNDING, Master_Table_Join_to_Peer_Groups_tbl.CORRESPONDENT , Master_Table_Join_to_Peer_Groups_tbl.[ACCOUNT EXECUTIVE], Master_Table_Join_to_Peer_Groups_tbl.STATUS, Master_Table_Join_to_Peer_Groups_tbl.[DATE APPROVED], Master_Table_Join_to_Peer_Groups_tbl.BRANCH, Master_Table_Join_to_Peer_Groups_tbl.branch_name, Master_Table_Join_to_Peer_Groups_tbl.TotalLoanAmou nt, Master_Table_Join_to_Peer_Groups_tbl.Jan_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Jan_App_Count , Master_Table_Join_to_Peer_Groups_tbl.Feb_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Feb_App_Count , Master_Table_Join_to_Peer_Groups_tbl.Mar_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Mar_App_Count , Master_Table_Join_to_Peer_Groups_tbl.Apr_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Apr_App_Count , Master_Table_Join_to_Peer_Groups_tbl.May_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.May_App_Count , Master_Table_Join_to_Peer_Groups_tbl.Jun_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Jun_App_Count , Master_Table_Join_to_Peer_Groups_tbl.Jul_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Jul_App_Count , Master_Table_Join_to_Peer_Groups_tbl.Aug_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Aug_App_Count , Master_Table_Join_to_Peer_Groups_tbl.Sept_Loan_Amo unt, Master_Table_Join_to_Peer_Groups_tbl.Sept_App_Coun t, Master_Table_Join_to_Peer_Groups_tbl.Oct_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Oct_App_Count , Master_Table_Join_to_Peer_Groups_tbl.Nov_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Nov_App_Count , Master_Table_Join_to_Peer_Groups_tbl.Dec_Loan_Amou nt, Master_Table_Join_to_Peer_Groups_tbl.Dec_App_Count , Master_Table_Join_to_Peer_Groups_tbl.First_3_Month _Loan_Amount, Master_Table_Join_to_Peer_Groups_tbl.First_3_Month _App_Count, Master_Table_Join_to_Peer_Groups_tbl.First_6_Month _Loan_Amount, Master_Table_Join_to_Peer_Groups_tbl.First_6_Month _App_Count, Master_Table_Join_to_Peer_Groups_tbl.First_9_Month _Loan_Amount, Master_Table_Join_to_Peer_Groups_tbl.[9Month_App_Count], Master_Table_Join_to_Peer_Groups_tbl.[12_Month_Loan_Amount_10], Master_Table_Join_to_Peer_Groups_tbl.[12Month_App_Count_10], Master_Table_Join_to_Peer_Groups_tbl.First_12_Mont h_App_Count, Master_Table_Join_to_Peer_Groups_tbl.[Past_3_Month$], Master_Table_Join_to_Peer_Groups_tbl.[Past_3_Month#], Master_Table_Join_to_Peer_Groups_tbl.[Past_6_Month$], Master_Table_Join_to_Peer_Groups_tbl.[Past_6_Month#], Master_Table_Join_to_Peer_Groups_tbl.[Past_9_Month$], Master_Table_Join_to_Peer_Groups_tbl.[Past_9_Month#], Master_Table_Join_to_Peer_Groups_tbl.[Past_12_Months$], Master_Table_Join_to_Peer_Groups_tbl.[Past_12_Months#], 1+DCount("*","([Master_Table_Join_to_Peer_Groups_tbl])","([Past_3_Month#])<" & ([Past_3_Month#])) AS 3Rank
    FROM Master_Table_Join_to_Peer_Groups_tbl
    WHERE (((Master_Table_Join_to_Peer_Groups_tbl.[BRANCH #])=49) AND ((Master_Table_Join_to_Peer_Groups_tbl.FUNDING)="T ABLE") AND ((Master_Table_Join_to_Peer_Groups_tbl.STATUS)="ac tive")) OR (((Master_Table_Join_to_Peer_Groups_tbl.[BRANCH #])=50) AND ((Master_Table_Join_to_Peer_Groups_tbl.FUNDING)="T ABLE") AND ((Master_Table_Join_to_Peer_Groups_tbl.STATUS)="ac tive")) OR (((Master_Table_Join_to_Peer_Groups_tbl.[BRANCH #])=51) AND ((Master_Table_Join_to_Peer_Groups_tbl.FUNDING)="T ABLE") AND ((Master_Table_Join_to_Peer_Groups_tbl.STATUS)="ac tive")) OR (((Master_Table_Join_to_Peer_Groups_tbl.[BRANCH #])=52) AND ((Master_Table_Join_to_Peer_Groups_tbl.FUNDING)="T ABLE") AND ((Master_Table_Join_to_Peer_Groups_tbl.STATUS)="ac tive"))
    ORDER BY Master_Table_Join_to_Peer_Groups_tbl.[Past_3_Month#] DESC;[/sql]

    Thanks for taking the time to help
    TCB

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I am not sure what you are asking. But if you want to run a series of queries in a specific order, then create a query that is used for the next query's source. When you create a new query, Access allows you to pick a Query or Table. I routinely create multiple queries to get the data transformed the way I want. I do something like:

    Query001
    Query005
    Query010

    Where Query001 is based off the data tables. Query005 is based off of Query001,etc. Then for the form or report I use Query010 as the data source.

Posting Permissions

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