Pls could anyone help is there any where have gone wrong

I := 0;

FOR I := 1 TO DIMNO DO BEGIN

GLENTRY2.RESET;

GLENTRY2.SETCURRENTKEY(“Posting Date”,“Global Dimension 1 Code”,Amount);

GLENTRY2.SETRANGE(GLENTRY2.“Global Dimension 1 Code”,DIM[I]);

GLENTRY2.SETFILTER(GLENTRY2.“Posting Date”,’%1…%2’,STARTDATE,ENDDATE);

GLENTRY2.SETFILTER(GLENTRY2.Amount,’>%1’,0);

IF GLENTRY2.FIND(’-’) THEN BEGIN

REPEAT

IF GLENTRY2.Amount = 2000 THEN BEGIN

GLENTRY2.CALCSUMS(GLENTRY2.Amount);

AMOUNTFREQ[I] := GLENTRY2.Amount;

END

ELSE

IF (GLENTRY2.Amount > 2000) AND (GLENTRY2.Amount < 5000) THEN BEGIN

GLENTRY2.CALCSUMS(GLENTRY2.Amount);

AMOUNTFREQ1[I] := GLENTRY2.Amount;

END

ELSE

IF (GLENTRY2.Amount > 5000) AND (GLENTRY2.Amount < 10000) THEN BEGIN

GLENTRY2.CALCSUMS(GLENTRY2.Amount);

AMOUNTFREQ2[I] := GLENTRY2.Amount;

END

ELSE

IF (GLENTRY2.Amount > 10000) AND (GLENTRY2.Amount < 50000) THEN BEGIN

GLENTRY2.CALCSUMS(GLENTRY2.Amount);

AMOUNTFREQ3[I] := GLENTRY2.Amount;

END

ELSE

IF (GLENTRY2.Amount > 50000) AND (GLENTRY2.Amount < 100000) THEN BEGIN

GLENTRY2.CALCSUMS(GLENTRY2.Amount);

AMOUNTFREQ4[I] := GLENTRY2.Amount

END

UNTIL GLENTRY2.NEXT = 0;

thanks all