How to list Query Results on a report.

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
 
B

Bas Cost Budde

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")
 
B

Bas Cost Budde

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.
 
D

DOYLE60

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
 

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