帮忙写个代码这两天搞到头都大了。

解决方案 »

  1.   

    MSHFlexGrid的内容传给一个数据集rs,DataReport的数据源为rs即可
      

  2.   

    section1添加与mshflexgrid列一样多的
    textbox(非绑定)rst与报表数据源绑定
    字段与textbox绑定
      

  3.   

    dim rs as new adodb.recodeset
      For i = 1 To MSHFlexGrid.Rows - 1
      rs.AddNew
      rs.Fields(0) = MSHFlexGrid.TextMatrix(i, 1)
      rs.Fields(1) = MSHFlexGrid.TextMatrix(i, 2)
      ......
      rs.Update
      Next
      Set DataReport1.DataSource = rs
      DataReport1.Sections(1).Controls(1).Caption = Text1.text
      DataReport1.Sections(1).Controls(2).Caption = Text2.text
      .......
      
      DataReport1.show
      

  4.   

    就是说,由MSHFlexGrid动态生成一个记录集的嘛~
    也不难~
      

  5.   


     Do While Not Rst.EOF
        Rst.AddNew
        Row = Row + 1
        Rst.Fields("1").Value = MSFGList.TextMatrix(Row, 1)
        Rst.Fields("2").Value = MSFGList.TextMatrix(Row, 2)
        Rst.Fields("3").Value = MSFGList.TextMatrix(Row, 3)
        Rst.Update
      Loop
      Rst.UpdateBatch