I'm having a problem for getting the result in Running Total Fields if

I include it in a group.

Example Data:

Code:=====Amount:=====Year:
=A========100========1998
=A========200========1999
=B========400========1998
=A========300========2000
=B========400========1999
=B========400========2001

Result in crystal report should be:

Group [per Year]:
in 1998
Code:=====Amount:=====Running Total Fields of Amount:
=A=========100========100
=B=========400========400 - (Note: should reset to zero on change of new code then get the Amount of that code)

in 1999
Code:=====Amount:=====Running Total Fields of Amount:
=A=========200========300 - (Note: The result is added from 1998 of Code A)
=B=========400========800 - (Note: The result is added from 1998 of Code B)


in 2000
Code:=====Amount:=====Running Total Fields of Amount:
=A=========300========600 - (Note: The result is added from Total Fields in 1999 of Code A)


in 2001
Code:=====Amount:=====Running Total Fields of Amount:
=B=========400========1200 - (Note: The result is added from the Total Fields in 1999 of Code B)

Is it right to have a running total fields or make a formula?

I'm not having a headache if i didn't include it in a yearly group. Coz the running total fields added all the Amounts in each group and reset everytime new codes read from the data.
But I need to have a yearly report. And if I run it having in a group it didn't result a required output.

Please I'd like to have a solution for this, tnx.