How can i have zero values in 2 fields when the criteria in a third field is false

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • annakalli
    New Member
    • May 2010
    • 34

    #16
    You was right my code was a bit confusing in those lines so i follow your advice and i changed is as you can see below
    Code:
    SELECT TBLBANKSTRANSACTIONS.ID, TBLBANKSTRANSACTIONS.[TRANSACTION NUMBER], TBLBANKSTRANSACTIONS.[TRANSACTION DATE], TBLBANKSTRANSACTIONS.[AR EGGRAFOU], TBLBANKSTRANSACTIONS.DESCRIPTION, TBLBANKSTRANSACTIONS.DRAMOUNT, TBLBANKSTRANSACTIONS.CRAMOUNT, TBLBANKSTRANSACTIONS.[TYPE OF TRANSACTION], TBLBANKSTRANSACTIONS.[BANK CODE], Nz([TOTAL-BALANCES ACCORDING TO SELECTED DATES].BALANCEDR-BALANCECR,0) AS [balance], [TOTAL-BALANCES ACCORDING TO SELECTED DATES].BALANCEDR, [TOTAL-BALANCES ACCORDING TO SELECTED DATES].BALANCECR
    FROM TBLBANKSTRANSACTIONS LEFT JOIN [TOTAL-BALANCES ACCORDING TO SELECTED DATES] ON TBLBANKSTRANSACTIONS.[BANK CODE]=[TOTAL-BALANCES ACCORDING TO SELECTED DATES].[BANK CODE]
    WHERE (TBLBANKSTRANSACTIONS.[TRANSACTION DATE] Between Forms![Report Date Range]![Beginning Trans Date] And Forms![Report Date Range]![Ending Trans Date]) And ((TBLBANKSTRANSACTIONS.[BANK CODE])=[Please type the bank code]);
    I can understand what do you mean by your next tip
    "This is not done in [TOTAL-BALANCES ACCORDING TO SELECTED DATES], but rather in [TBLBANKS_TRANSA CTIONS]. Each reference to [TOTAL-BALANCES ACCORDING TO SELECTED DATES] needs to use Nz() around it here. Not in the source."

    how can i do that?

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32633

      #17
      Originally posted by AnnaKalli
      AnnaKalli:
      how can i do that?
      If you look at lines #10 through #12 of my code you'll see I've already done it for you ;-)

      Comment

      • annakalli
        New Member
        • May 2010
        • 34

        #18
        Thank u so much, it works perfectly now. All my regards from the sunshine Cyprus :-)

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32633

          #19
          You're welcome Anna from Sunny Cyprus :-)

          Comment

          Working...