Do While Function

  • Thread starter Thread starter Chapco Ryno
  • Start date Start date
C

Chapco Ryno

I need a simple do while loop or whatever would work best
to read all the rows in a specified column and return
them concatenated into one string separated by semicolons
like in my example below

Column in table contains an email address in each record:

(e-mail address removed)
(e-mail address removed)

need the loop to read through all records in that column
and return a string like:

"(e-mail address removed);[email protected]"......etc, so
that I can paste or use that for an Outlook To field.

Thanks in advance for any help you can lend me!!!

Chapco Ryno
 
Column in table contains an email address in each record:

(e-mail address removed)
(e-mail address removed)

need the loop to read through all records in that column
and return a string like:

' this line may not be neccesary
rs.MoveFirst

' start a loop
do while not rs.EOF

' this is not the most efficient way of doing this
' but it's the clearest!
if len(strList)>0 then strList=strList & ","

' now add the current value
' null values are implicitly coerced to ""
strList = strList & rs!EmailAddress

' okay, now look at the next record
rs.MoveNext

' the loop will stop when the recordset gets to EOF
loop

Hope that helps


Tim F
 
Back
Top