Concatenate records from a query in 1 line

Hulk009

New member
Local time
Today, 21:41
Joined
Jun 8, 2024
Messages
16
Hi

any help to merge all records in 1 field at the form footer with number list

Check Form called "OFF"



Will these way work for me:



=ConcatRelated("iddate", "dailyoff", "iddate =" & [dt]



I just want a simple way to merge the records in the form called "off" in 1 line with number list before every name seperated by "-"
 

Attachments

Not sure if this is what you mean.
 

Attachments

There is no function ConcatRelated() in your db so No, it won't work.

Here is Allen Browne's ConcatRelated() function http://allenbrowne.com/func-concat.html

Do you want output like: 1-Alex, 2-Tom, 3-Perla, 4-George, 5-Peter

A little modification of Allen's code can do that. First add variable:
Dim x As Integer

Then modify loop to use:
Code:
    'Loop through the matching records
    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
                    x = x + 1
                    strOut = strOut & x & "-" & rsMV(0) & strSeparator
                End If
                rsMV.MoveNext
            Loop
            Set rsMV = Nothing
        ElseIf Not IsNull(rs(0)) Then
            x = x + 1
            strOut = strOut & x & "-" & rs(0) & strSeparator
        End If
        rs.MoveNext
    Loop
Expression in textbox: =ConcatRelated("NamePrename","DailyOff","IDDate=#" & CDate([IDDate]) & "#")

Strongly advise not to use spaces nor punctuation in naming convention.
 
Last edited:
And if you want the names alphabetical:
=ConcatRelated("NamePrename","DailyOff","IDDate=#" & CDate([IDDate]) & "#","NamePrename")
 
This appears to be a continuation of:

 
This appears to be a continuation of:

Seems to be the norm for some people, just crossposting, even after having responses. :mad:
 
Seems to be the norm for some people, just crossposting, even after having responses. :mad:

In this case I'd wonder if the OP misinterpreted Pat's comments and thought they were supposed to re-post the question in a different forum.
 
Well I thought she was just moving it to a more appropriate forum.
Easy to check it it is there, I would have thought.
At least it was under the same username this time. :)
 
Sorry if I caused confusion. While I was typing, I think someone answered the question.
 

Users who are viewing this thread

Back
Top Bottom