help in MS Access query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rema
    New Member
    • Feb 2015
    • 6

    #1

    help in MS Access query

    hi everyone
    I am making a MS Access program for inventory..
    I need help in making a query for
    sum the incoming materials
    and outgoing materials !!
    should i use (iif) statement ??
    so if the transaction type is (in) , it return the amount field , and if the transaction type field is (out) it return (amount * -1 ) ?
    then sum the all amounts ??
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Yes, you can use the iif to flip the sign.

    Comment

    • Rema
      New Member
      • Feb 2015
      • 6

      #3
      I tried , but it did not work :(
      iif([orderDeta!trans]= "in";[det!qy];[det!qy]* -1);
      Whats the wrong ?

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Is orderDeta and det the table names? The delimiter for function arguments are commas, not semicolons.
        Code:
        iif(orderDeta.trans='in',det.qy,det.qy* -1)

        Comment

        • Rema
          New Member
          • Feb 2015
          • 6

          #5
          yes , they are.
          it keeps giving me syntax error :(

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            That usually means one of your fields or table names are spelled incorrectly. Please post the full SQL code

            Comment

            • Rema
              New Member
              • Feb 2015
              • 6

              #7
              never mind :)
              thx ..I fixed it

              Comment

              Working...