表:
项目,序号,值
A    1   0.25
A    2   0.54
A    3   0.88
B    1   0.44
B    2   0.45
B    3   0.55
要用报表打印成:
序号 A    B
1   0.25 0.44
2   0.54 0.45
3   0.88  0.55这样的算不算交叉表呀:

解决方案 »

  1.   

    先设计好表,然后在SQL查询中进行交叉查询.
      

  2.   

    交叉表的定义不是你所想像的这个样子的。
    你这个报表格式可以用内建Recordset来实现!如:
    Dim Rst as New ADODB.RecordsetWith Rst
        .Fields.Append "Field1", adSingle
        .Fields.Append "Field2", adSingle
        .Open
        ...
        '在这里把记录追加进去
    End With
      

  3.   

    不难吧,例如A在TA表中,B在TB表中,只要写个查询就可以出来这种结果啊
    select TA.序号,TA.A值,TB.B值 from TA,TB where TA.序号=TB.序号,然后把这个结果集给到报表中就可以啊--------------------------------
      

  4.   

    我覺得我的思路已經很明顯了:
    1、首先按照上述代碼,建立一個臨時Recordset;
    2、把你查出來的記錄,按照你想要的順序填充到這個Recordset中。你想A在一列,B在一列,那麼分成兩次查詢原記錄並追加到新建的Recordset中,如
        your_rst.open select 項目,值 from your_table where 項目='A', your_con
        do unitl your_rst.eof
           my_tmp_rst(0)=your_rst(0)
           my_tmp_rst(1)=your_rst(1)
        loop    your_rst.open select 項目,值 from your_table where 項目='B', your_con
        do unitl your_rst.eof
           my_tmp_rst(0)=your_rst(0)
           my_tmp_rst(1)=your_rst(1)
        loop然後,把這個Recordset指定為報表數據源,明白了嗎?
      

  5.   

    對不起,上述代碼有誤,正確應為:
        your_rst.open select 值 from your_table where 項目='A', your_con
        do unitl your_rst.eof
           my_tmp_rst.addnew
           my_tmp_rst(0)=your_rst(0)
           your_rst.movenext
        loop    your_rst.open select 值 from your_table where 項目='B', your_con
        my_tmp_rst.movefirst
        do unitl your_rst.eof
           my_tmp_rst(1)=your_rst(0)
           my_tmp_rst.movenext
           your_rst.movenext
        loop
      

  6.   

    表中的项目"A,b,,,,,z....可能有很多很多,不一定只有两个英目,这是动态添加的