我作了自定义字段文件,单独测试时能显示出字段名称,但放在程序里字段名没有了,记录也显示不出来,只有报表标题,这是怎么回事呀?

解决方案 »

  1.   

    Set objCRReport = objCRApp.OpenReport(App.Path & "\ReportMain.rpt", 1)
        
        '加载主报表字段定义文件
        Set props = objCRReport.Database.Tables(1).ConnectionProperties
        For Each prop In props
            If InStr(prop.Name, "Field Definition File") > 0 Then
               prop.Value = App.Path & "\Students.ttx"
               Exit For
            End If
        Next
        Set props = Nothing
        '给主报表赋值
        objCRReport.DiscardSavedData
        objCRReport.Database.Tables(1).SetDataSource rst1参考这段代码,循环赋值看看
      

  2.   

    按老兄的办法,我要定义props为什么呀?
    dim props as new ?????
    我的记录源不是表,是一个查询,你上面那段代码我要怎么改呀?