程式如下:
第二次執行時 recordset.field.value 的資料是正確的 但是前幾列的資料用 AddItem 就是無法顯示出來 (第一次執行 OK!) 苦思不解 有那位可以指點迷津! 謝謝!
For i = 1 To j ' 清除資料行
msdDetail.RemoveItem 1
Next
msdDetail.Cols = 11
j = 0
While Not rsPn.EOF
j = j + 2 ' 一筆資料分成兩行
Ned_Detail = Chr(9) & rsPn.Fields(0) & Chr(9)&_
rsPn.Fields(1) & Chr(9) & rsPn.Fields(2)
For i = 0 To rsPn.Fields.Count - 1
Select Case i
Case i = 0 To 9
Prd_Detail = Prd_Detail & Chr(9) &_
rsPn.Fields(i).Value
Case i = 10 To rsPn.Fields.Count - 1
Ned_Detail = Ned_Detail & Chr(9) &_
rsPn.Fields(i).Value
End Select
Next
msdDetail.AddItem Prd_Detail
msdDetail.AddItem Ned_Detail
Prd_Detail = ""
Ned_Detail = ""
rsPn.MoveNext
Wend
'設定顏色
msdDetail.Col = 4
msdDetail.RowHeight(1) = 0
' 定 col width
msdDetail.ColWidth(0) = 0
msdDetail.ColWidth(1) = 2500
msdDetail.ColWidth(2) = 900
msdDetail.ColWidth(3) = 600
msdDetail.ColWidth(4) = 980
msdDetail.ColWidth(5) = 980
msdDetail.ColWidth(6) = 980
msdDetail.ColWidth(7) = 980
msdDetail.ColWidth(8) = 980
msdDetail.ColWidth(9) = 980
msdDetail.ColWidth(10) = 980
msdDetail.FixedCols = 4
msdDetail.MergeCells = 3
msdDetail.MergeCol(0) = False
msdDetail.MergeCol(1) = True
msdDetail.MergeCol(2) = True
msdDetail.MergeCol(3) = False
msdDetail.MergeCol(4) = False
msdDetail.MergeCol(5) = False