public function aaa("艺术家字段" as string, "表名" as string, "唱片ID" as string,optional bbb as string)
dim rst as dao.recordset
set rst = currentdb().openrecordset("select * from " & "表名" & IIf([唱片ID] = "", "", " Where " & "唱片ID"))
aaa = rst("艺术家字段")
rst.MoveNext
do while not rst.eof
aaa = aaa & bbb & rst("艺术家字段")
rst.movenext
loop
end function
再做一个查询:
select 表1.字段1, aaa("[艺术家字段]","表名","[唱片ID]='" & [唱片ID] & "'") AS 表达式1
from 表名
group by 表名.唱片ID;