"Keith Wilby" <here@there.comwrote in message
news:4559a949$1_1@glkas0286.greenlnk.net...
Quote:
"NoviceProgramer" <hgnov3000@gmail.comwrote in message
news:1163503912.144038.231830@b28g2000cwb.googlegr oups.com...
Quote:
>Thank you Keith for your reply, but actually I want to gather the
>Family Names of my students to a single textbox ie if the query outputs
>four students, then the textbox should contains:
>"Student01, Student02, Student03, and Student04."
>>
>any sugestions about how to do this?
>>
>
I think you'd need to write some code to loop through the records to
concatenate a field like that, unless someone else can jump in and suggest
something ... I don't think there's anything out of the box that will do
it for you.
>
Keith.
>
Here's some code I used to concatenate a field called DES_AREA, you might be
able to adapt it:
Public Function libDA(strID As String) As String
Dim db As Database, rs As Recordset, strSQL As String
Set db = CurrentDb
strSQL = "Select [DES_AREA] from tblMyTable where [fldID] = " & strID & ";"
Set rs = db.OpenRecordset(strSQL)
With rs
If .EOF Then Exit Function
Do Until .EOF
libDA = libDA & ![DES_AREA] & ", "
.MoveNext
Loop
End With
libDA = Left(libDA, Len(libDA) - 2)
End Function