Need help with concatenation function

E

EllenM

Hello,
I've found a wonderful concatenation function at
http://www.mvps.org/access/modules/mdl0008.htm. It, however, separates the
concatenated values with semicolons when I'd like them to be separated with
"<br />"s.

For instance, instead of "Value1; Value2; Value3", I'd like "Value1<br />
Value2<br /> Value3<br />".

Thanks in advance for your help.

Ellen
 
B

Bob Barrows

EllenM said:
Hello,
I've found a wonderful concatenation function at
http://www.mvps.org/access/modules/mdl0008.htm. It, however,
separates the concatenated values with semicolons when I'd like them
to be separated with "<br />"s.

For instance, instead of "Value1; Value2; Value3", I'd like
"Value1<br /> Value2<br /> Value3<br />".

Thanks in advance for your help.

Ellen

I don't have the function in front of me, but surely it can't be too hard to
change the '& ";" 'bit to '& "<br />"'
 
J

John W. Vinson

Hello,
I've found a wonderful concatenation function at
http://www.mvps.org/access/modules/mdl0008.htm. It, however, separates the
concatenated values with semicolons when I'd like them to be separated with
"<br />"s.

For instance, instead of "Value1; Value2; Value3", I'd like "Value1<br />
Value2<br /> Value3<br />".

Thanks in advance for your help.

Ellen

Just fix the code to your needs: where it has

With lors
If .RecordCount <> 0 Then
'start concatenating records
Do While Not .EOF
lovConcat = lovConcat & lors(stFldToConcat) & "; "
.MoveNext
Loop
Else
GoTo Exit_fConcatFld
End If
End With

change it to

With lors
If .RecordCount <> 0 Then
'start concatenating records
Do While Not .EOF
lovConcat = lovConcat & lors(stFldToConcat) & " <br /> "
.MoveNext
Loop
Else
GoTo Exit_fConcatFld
End If
End With
 
J

John Spencer

you would also need to fix the code in one other spot near the bottom of the
routine. If you want "<br /> " at the end of the string or not.

Either
fConcatFld = lovConcat
OR
fConcatFld = Left(lovConcat, Len(lovConcat) - Len("<br /> "))
instead of
fConcatFld = Left(lovConcat, Len(lovConcat) - 2)




John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
E

EllenM

Thanks, John

And change:
fConcatFld = Left(lovConcat, Len(lovConcat) - 2)

to
fConcatFld = Left(lovConcat, Len(lovConcat) - 8)

Now it's a masterpiece.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top