forming one big string from multiple records (1 Viewer)

A

averkinderen

Guest
hello,

I don't know how to do this:

I have a table with 2 columns name and ndef
ndef refere to the the article or book id that the author has written.

for example:

tom clancy 235

now I want a doc-file with all the authors+all the ndefs after each other, in fact in one big string.

so:
tom clancy 2
tom clancy 3
tom clancy 4
averkinderen 5
averkinderen 6

becomes:
tom clancy 2,3,4
averkinderen 5,6


I think I have to do it with a while
while ....is not eof
while tom clancy=tom clancy
string=ndef+ndef

or something like that....
how do I do this?
 
Last edited:

Surjer

Registered User.
Local time
Today, 22:14
Joined
Sep 17, 2001
Messages
232
Might try this...
Code:
dim db as dao.database
dim rs as dao.recordset
dim rs2 as dao.recordset
dim finalString as String
set rs = db.OpenRecordset("Select Name from MyTable GROUP BY Name")

do while not rs.eof
finalString = rs("Name")
set rs2 = db.OpenRecordset("Select * from MyTable where name = " & chr(34) & rs("Name") & chr(34)
do while not rs2.eof
finalString = finalString & "," & ndefs
rs2.movenext
Loop
msgbox finalString
rs.movenext
loop
 
Last edited:

Users who are viewing this thread

Top Bottom