You can't do it all inside the report. You have to calculate the totals beforehand, then link the totals cursor to the doctor table. Group header will be the doctor. Detail1 is patients. Detail2 is totals.
>Hello Graig
>
>I probably not explain my problem the right way.
>
>What I want to print is all the patients with their code for a doctor, and after I want to print all the code that the docotor use for is patient with the number of each code.
>
>Each patient can have three different code.
>
>The report alredy have the doctor in the header and the patient in the first detail.
>
>The thing that i dont understand is how can i link the patient with total per code
>
>I have joint 2 images of my table the prt containt the patient nam the doctor code and the three code
>The TotCodevulMed containt the total per code for the patient for this doctor
>
>Thank you for your help
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer