Receiving Communion in grave sin is not to be done. One must first receive Sacramental absolution, except in the case of a grave reason. Canon 916 states:
Can. 916 A person who is conscious of grave sin is not to celebrate Mass or receive the body of the Lord without previous sacramental confession unless there is a grave reason and there is no opportunity to confess; in this case the person is to remember the obligation to make an act of perfect contrition which includes the resolution of confessing as soon as possible.
My priest, a very good and faithful one, believes that a person can receive before Sacramental absolution if the person has made a perfect act of contrition and is resolved not to sin in the future. (I believe when I show him this he may suggest that receiving Communion is a grace reason, because Communion is so important.) Is anyone aware of any futher statements on this subject made by a pope or other eccesiastical documents?