王子月
花朵
共回答了26个问题采纳率:76.9% 举报
用count,否则的话,如果记录太多,你将不停地MoveNext,不停地判断b=a.
Dim i As Integer,n As Long,s As String
Text8 = ""
Adodc1.RecordSource = " select 字段15的名称,count(*) from inf where 下单时间 between #" & DTP1.Value & "# and #" & DTP2.Value & "# group by 字段15的名称"
Adodc1.Refresh
For i = 0 To Combo1.ListCount - 1
s = Combo1.List(i)
n = 0
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
If Adodc1.Recordset.Fields(0) = s Then n = Adodc1.Recordset.Fields(1):Exit Do
Adodc1.Recordset.MoveNext
Loop
Text8 = Text8 & "," & s & "共" & n & "条记录"
Next
将上述语句中的“字段15的名称”修改为你数据库中inf表的第16个字段的字段名称.
1年前
4