Allen Browne's ConcatRelated() Error 3061: Too few parameters

Deadly 提交于 2021-01-29 03:01:01

问题


I am trying to create a list of products at a given warehouse. Allen Browne's ConcatRelated() function seems to be the tried and true method to create lists using when a linked variable is the same, but I can't get it to work.

I have broken my information down into a single query... "qry_Products"

SELECT qry_AX_LineItems_LINES.Warehouse, tblREF_Chemical.[Sales Name]
FROM qry_AX_LineItems_LINES INNER JOIN tblREF_Chemical ON 
qry_AX_LineItems_LINES.ItemId = tblREF_Chemical.[Item Number]
GROUP BY qry_AX_LineItems_LINES.Warehouse, tblREF_Chemical.[Sales Name];

It produces a table with the Sales Name and Warehouse(s).

What I need to see happen is a list of the Sales Names when their warehouse matches.

I have tried using the function in a textbox of my form...

=ConcatRelated("[Sales Name]","[qry_Products]"," Warehouse ='" & [Warehouse] 
& "'")

It causes an Error 3061 and leaves the cell blank.

I double checked my syntax within the quotes by using Dlookup(), and it produced the first result of the list.

I have also tried altering my query...

SELECT qry_AX_LineItems_LINES.Warehouse, ConcatRelated("[Sales Name]"," 
[tblREF_Chemical]") AS Expr1
FROM qry_AX_LineItems_LINES INNER JOIN tblREF_Chemical ON 
qry_AX_LineItems_LINES.ItemId = tblREF_Chemical.[Item Number];

Unfortunately it then lists every product in my database as a list.

I also tried creating a new query to reference the one producing minimal information.

SELECT ConcatRelated("[Sales Name]","qry_Products") AS Expr1
FROM qry_Products;

I know that the initial query is correct but when I go to run the new query I get multiple pop-ups of Error 3061 and empty cells for results.

I double checked that I am copying the module exactly. http://allenbrowne.com/func-concat.html Module is named "Concat".

I'm reading every help guide out there but I just can't see what I should try next.

Thank you so much for time and any advice!

SubForm frm_LineItems

Query qry_Products


回答1:


I found another thread that gives an alternative to the Allen Browne method. https://bytes.com/topic/access/answers/569535-combining-rows-opposite-union

This seems to be working.

'Concat Returns lists of items which are within a grouped field
Public Function Concat(strGroup As String, strItem As String) As String
Static strLastGroup As String
Static strItems As String

If strGroup = strLastGroup Then
    strItems = strItems & ", " & strItem
Else
    strLastGroup = strGroup
    strItems = strItem
End If
Concat = strItems
End Function

with Query SQL

SELECT WH,
Max(Concat(WH, [Sales Name])) AS Products
FROM [qry_Products]
GROUP BY WH

I wanted to leave this here in case anyone else was having a similar issue.



来源:https://stackoverflow.com/questions/54789423/allen-brownes-concatrelated-error-3061-too-few-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!