Report由Frm_CountClothes启动,Report的Implementation段引用了一个Unit UntClothes, 在NeedData里,计算了nCol/nRow没错误:sValue:=UntClothes.frm_CountClothes.CenterGrid1.Cells[nCol,nRow];写代码过程中没有一点错误,一执行到这里就出错Read  xxx Access Error,为什么!!!简直疯了!

解决方案 »

  1.   

    我这样做的:主界面:uses UntCountClothes.......
    ......var
       frm_CountClothes:tFrm_CountClothes;
    Begin
       frm_CountClothes:=tFrm_CountClothes.Create(self);
       frm_CountClothes.Show;
    End;
    ....在FRM_CountCLothes:
    uses Rpt_Clothes.....
    ....Rpt_Clothes.PreviewModal;在程序的Initlize创建了rpt_CLothes的实例。
    这样做的其他地方都可以,只有这里很怪不行。现在解决了:
    在主单元UntMDI全部引用之,然后创建一个:
    var
       frm_Free:tForm;
    ......在打印调用:
    uses UntMDI;
    ....(UntMDI.frm_Free as UntCountClothes.tFrm_CountClothes).CenterGrid1.Cells[nCol,nRow];有什么更好的办法?谢谢各位。