|
Dim Rs As New ADODB.Recordset
Dim Rst As New ADODB.Recordset
Dim Str As String
Rst.Open "SELECT First(代码) FROM 表1 GROUP BY 代码", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Do While Not Rst.EOF
Rs.Open "select * from 表1 where 代码='" & Rst.Fields(0) & "'", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Do While Not Rs.EOF
Str = Str & Rs.Fields("简称") & ","
Rs.MoveNext
Loop
MsgBox Str
Set Rs = Nothing
Rst.MoveNext
Loop
Set Rst = Nothing
|
|