CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Location
    St Paul, MN - USA
    Posts
    48

    If...Then...Else... Error.

    Can someone tell me why is this not working? After the else is the error. It states that it is not part of the formula.

    WhilePrintingRecords;
    numberVar numNB;
    numberVar numRPC;
    numberVar numMC;
    numberVar numMRPC;
    numberVar numDPP;

    numberVar numNB2;
    numberVar numRPC2;
    numberVar numMC2;
    numberVar numMRPC2;
    numberVar numDPP2;

    if {tran_date} in Aged31To60Days then
    numNB := numNB + Count({debtor_no});
    numRPC := numRPC + {#RTotalDialerRPC};
    numMC := numMC + {#RTotalManualCalled};
    numMRPC := numMRPC + {#RTotalManualRPC};
    numDPP := numDPP + {#RTotalPP};
    else
    if {tran_date} in Aged61To90Days then
    numNB2 := numNB2 + Count({debtor_no});
    numRPC2 := numRPC2 + {#RTotalDialerRPC};
    numMC2 := numMC2 + {#RTotalManualCalled};
    numMRPC2 := numMRPC2 + {#RTotalManualRPC};
    numDPP2 := numDPP2 + {#RTotalPP};

  2. #2
    Join Date
    May 2006
    Posts
    324

    Re: If...Then...Else... Error.

    If you want multiple statements to run after a condition check then enclose them in brackets. e.g.

    if {tran_date} in Aged31To60Days then
    (
    numNB := numNB + Count({debtor_no});
    numRPC := numRPC + {#RTotalDialerRPC};
    numMC := numMC + {#RTotalManualCalled};
    numMRPC := numMRPC + {#RTotalManualRPC};
    numDPP := numDPP + {#RTotalPP};
    )
    else
    (
    if {tran_date} in Aged61To90Days then
    numNB2 := numNB2 + Count({debtor_no});
    numRPC2 := numRPC2 + {#RTotalDialerRPC};
    numMC2 := numMC2 + {#RTotalManualCalled};
    numMRPC2 := numMRPC2 + {#RTotalManualRPC};
    numDPP2 := numDPP2 + {#RTotalPP};
    );

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured