Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    111

    Unanswered: calling a query from another

    i have a query in an access database which is say called
    Code:
    qryMain
    . it calls 2 other queries qryA and qryB and its body looks like the following:

    Code:
    SELECT qryA.*
    FROM qryA
    UNION qryB
    FROM qryB;
    using this as inspiration i wrote another query say
    Code:
    qryMain2
    inside qryMain2 is a code that resembles the following:

    Code:
    ...complicated sequel block preceding... 
    
    from(
    	select [set of columns here] 
                 from
                     (select [set of columns here]
                      from
                          qrySubofMain2
                      group by
                          ColA) AS qry1 
                 inner join qrySubofMain2 AS qry2
     	     on (qry2.ColA = qry1.ColA) AND (qry2.ColC = qry1.ColC)
    ) as qry3 
    ...some more code
    the error i am getting is:
    Code:
    Invalid object name 'qrySubofMain2'.(#208)
    i would be really really greatful if anyone can point to me what i am missing. TIA

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    The obvious question is what is "qrySubofMain2"? Nothing you've described would indicate it's a table or query in the database. Is it?
    Paul

  3. #3
    Join Date
    Jul 2006
    Posts
    111

    reply...

    qrySubofMain2 is another query (not an alias of a block within a query). thanks for the interest in my question.

Posting Permissions

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