PartA, PartB, PartF
...不
PartA, PartA, PartA, PartB, PartB, PartF
我不确定如何让这个自定义功能像这样工作。我的询问是......
SELECT DISTINCT PART_NUMBER,
ConcatRelated("SUPPLIER_NAME","tbl_supplier_list",
"PART_NUMBER=""" & [PART_NUMBER] & """")
FROM tbl_supplier_list;`
答案 0 :(得分:2)
修改ConcatRelated()
函数from Allen Browne,如下所示:
Do While Not rs.EOF
If bIsMultiValue Then
'For multi-valued field, loop through the values
Set rsMV = rs(0).Value
Do While Not rsMV.EOF
If Not IsNull(rsMV(0)) Then
If InStr(strOut, rsMV(0)) = 0 then ''''' ADD THIS
strOut = strOut & rsMV(0) & strSeparator
End If ''''' ADD THIS
End If
rsMV.MoveNext
Loop
Set rsMV = Nothing
ElseIf Not IsNull(rs(0)) Then
strOut = strOut & rs(0) & strSeparator
End If
rs.MoveNext
Loop
InStr()
函数将检查输出字符串strOut
中是否已存在当前值。如果是(如返回0所示),If()
语句将确保不添加当前值。