How to list Query Results on a report.

  • Thread starter Thread starter DOYLE60
  • Start date Start date
D

DOYLE60

I have a query that returns, at most, 7 items.

Sam
Joe
Ralph
Edward
Lewis

How can I put this on a report header in list form?:

Sam, Joe, Ralph, Edward, Lewis

Thanks in advance,

Matt
 
DOYLE60 said:
I have a query that returns, at most, 7 items.

Sam
Joe
Ralph
Edward
Lewis

How can I put this on a report header in list form?:

Sam, Joe, Ralph, Edward, Lewis

Assuming A97. Have this function in any module (untested):

Function EnumRecord(cTable as string)as string
dim cRes as string
dim rs as recordset
set rs=currentdb.openrecordset(ctable,dbopendynaset)
cres=""
do until rs.eof
if cres<>"" then cres=cres & ", "
cres=cres & rs(0)
rs.movenext
loop
rs.close
set rs=nothing
enumrecord=cres
end function

; create a text field on your report that has as its controlsource this
expression:

=enumrecord("yourquery")
 
Allen said:
Create a Crosstab query, where this field is the Column Heading.
Can you put that on a report then, without further 'instruction'? I
couldn't.
 
Thank you very much, Bas, it worked like a charm. I had absolutely no problems
putting it in. It worked on the first try.
Thanks again,

Matt
 
Back
Top