Question : Populate Textbox with all query returns on a field

I have a table used to fill data on a report. Typically, in this table, there may be between 2-4 records that need to be populated to a single textbox.

For example, if the report was about crayons, and I had a seperate record for each crayon, I would want to put the [colors] field in one text box (red, orange, yellow) on the report.
How to accomplish this? Thanks!

Answer : Populate Textbox with all query returns on a field

place this codes in a regular module

function combineSpec(vId as variant) as string
dim rs as dao.recordset, strSpec as string
strSpec=""
set rs=currentdb.openrecordset("select spec from tablename where customer_id=" & vId)
do until rs.eof
    strSpec=strSpec & "," & rs("spec")
rs.movenext
loop
combinespec=mid(strSpec,2)
end function

now create a query

select customer_id, combineSpec([customer_id])
from tableName
group by customer_id, combineSpec([customer_id])


Random Solutions  
 
programming4us programming4us