Function Mystr(myval) As String
Dim rs As New ADODB.Recordset
Dim ssql As String
ssql = "select * from 表1 where 字段1=" & myval
rs.Open ssql, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Mystr = ""
For i = 1 To rs.RecordCount
Mystr = Mystr & rs("字段2")
rs.MoveNext
Next
rs.Close
End Function
SELECT 表1.字段1, Mystr([字段1]) AS 字段2
FROM 表1
GROUP BY 表1.字段1;