Be aware that Outlook has a limit to how long the lcrecipients string can be, I have set a limit to 2000 in my program.
lcrecipient=''
Scan For !Empty(EMAIL) and &yourcondition
If Len(lcrecipient)=0
lcrecipient=ALLTRIM(EMAIL)
Else
lcrecipient=lcrecipient + ';' + AllTrim(EMAIL)
Endif
IF Len(lcrecipient)>=2000
Messagebox('Too many recipients!')
Endif
Endscan
>I am using the outlook mail program which I downloaded in the downloads section which works great.
>Although there is a variable called lcrecipients which I would like to populate from my table based on a parameter. Therefore my table looks like this:
>
>
>Dept Name Email
>T59 John John@ddddd.com
>T59 Mark Mark@ddddd.com
>T57 Julie Julie@ddddd.com
>T59 Susan Susan@ddddd.com
>
>
>What I would like to do is scan for a particular department then join the email adresses together to populate lcrecipients: For example if dept = T59 then
>
>lcrecipients="
John@ddddd.com,Mark@ddddd.com,Susan@ddddd.com"
>
>Im getting confused on putting the commas in and how to stop putting a comma in if it is the last email address found. Can anybody help me please?