Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display results as comma separated values

Status
Not open for further replies.

kat17

Technical User
Aug 21, 2005
17
AU
I'd like to display a list of names using commas in my report. Is this possible?

At the moment, my report looks like this:
FNAME LNAME
----------------
Rowan Atkins
Jon Bell
Matt Bowen


I would like it to look like this:

Rowan Atkins, Jon Bell, Matt Bowen


Can anybody help?
 
Hi
You could set a text box to a function
=ListOfNames()
Which might look roughly like this:
Code:
Function ListOfNames()
Dim rs As DAO.Recordset
Dim strList
Set rs = CurrentDb.OpenRecordset("Members")
Do While Not rs.EOF
  strList = strList & rs!FirstName & " " & rs!LastName & ", "
  rs.MoveNext
Loop
ListOfNames = Left(strList, Len(strList) - 2)
End Function
 
There is a generic concatenate function with sample usage at The code is also at faq701-4233.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top