query expression in an expression

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mbardwel
    New Member
    • Mar 2008
    • 2

    #1

    query expression in an expression

    I am building a query in Access 2003. Here is my problem.

    I create an expression called SUN_ST
    In a later expression I reference a calculation based on SUN_ST
    ie, MON_ST=sum-SUN_ST

    SUN_ST is not a value in a table it is a calculation/expression within the query.

    How do I reference a query expression within an expression.

    I tried MON_ST: [sum]-[SUM_ST] and when I run the query I get asked to enter the parameter value for SUN_ST

    Any help would be appreciated.

    Thanks
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by mbardwel
    I am building a query in Access 2003. Here is my problem.

    I create an expression called SUN_ST
    In a later expression I reference a calculation based on SUN_ST
    ie, MON_ST=sum-SUN_ST

    SUN_ST is not a value in a table it is a calculation/expression within the query.

    How do I reference a query expression within an expression.

    I tried MON_ST: [sum]-[SUM_ST] and when I run the query I get asked to enter the parameter value for SUN_ST

    Any help would be appreciated.

    Thanks
    You would have to reference the entire Expression that SUN_ST refers to.

    Comment

    • mbardwel
      New Member
      • Mar 2008
      • 2

      #3
      Originally posted by ADezii
      You would have to reference the entire Expression that SUN_ST refers to.
      That is what I thought... if anyone has any other ideas that would be great.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        There are rules about this. In some circumstances this is allowed, but in others it's not. It depends on the order of processing.

        Post your current SQL (if it's not too vast) and we'll see what we can find.

        Alternatively, a fairly foolproof method is to use a subquery to produce the calculated value (See Subqueries in SQL).

        Comment

        Working...