Private Sub Command2_Click()
Me.MSF2.Rows = 1
Me.MSF2.Cols = 4
s = Array("1000", "3000", "1000", "1000")
y = Array("行次", "病员名称", "规格", "数量")
For n = 0 To 3
Me.MSF2.ColWidth(n) = s(n)
Me.MSF2.TextMatrix(0, n) = y(n)
Next n
Call OpenConn
sql = "select distinct(a.药品名称) as 药品名称 ,(a.规格)as 规格 from cf_yp as a where 日期>='" & Format(DT1, "yyyy-mm-dd") & "'and 日期 <='" & Format(DT2, "yyyy-mm-dd") & "'order by 药品名称" 'and 地点='" & UserUserName & "'" 'p显示当月日期 计算当月的
rs.Open sql, cn, 1, 3
If rs.RecordCount > 0 Then
Do While rs.EOF = False '将记录显示到me.MSF2控件中
i = i + 1
Me.MSF2.ColAlignment(1) = 1 '向左对齐
Me.MSF2.ColAlignment(2) = 4 '向中对齐
Me.MSF2.AddItem (i)
Me.MSF2.Row = Me.MSF2.Rows - 1
Me.MSF2.TextMatrix(Me.MSF2.Row, 0) = "" & Format(Me.MSF2.Row, "000")
Me.MSF2.TextMatrix(Me.MSF2.Row, 1) = rs.Fields("药品名称")
Me.MSF2.TextMatrix(Me.MSF2.Row, 2) = rs.Fields("规格")
'属性色-------------------------
Call SetColor(Me.MSF2)
rs.MoveNext
Loop
End If
Call CloseConn
End Sub
我这个加载也慢,有没有比这个快的呢,不知道有没有这样的高手呢,要是有就出手帮帮忙了,