Concatenate string limit

message from Curt on 20 May 2004
I created a form which allows the user to select the
criteria/group of people they wish to send an email to.
After the selection a macro is used to concatenate the
emails in the To section of Outlook. This all works fine,
but for some reason when it goes through this process the
To: section only allows 255 charaters. Is there a rule
about a string having a limit of 255? I used a
concatenate function I got from some one a couple years.
Thanks for any suggestions

Function Concatenate(pstrSQL As String, _
Optional pstrDelim As String = "; ") As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strConcat As String 'build return string
Set db = CurrentDb
Set rst = db.OpenRecordset(pstrSQL)
With rst
If Not .EOF Then
.MoveFirst
Do While Not .EOF
strConcat = strConcat & .Fields(0) &
pstrDelim
.MoveNext
Loop
End If
.Close
End With
Set rst = Nothing
Set db = Nothing
If Len(strConcat) > 0 Then
strConcat = Left(strConcat, Len(strConcat) - Len
(pstrDelim))
End If
Concatenate = strConcat
End Function
 
Cheryl Fischer replied to Curt on 20 May 2004
You have not indicated how you are creating your emails; however, if you are
using Outlook Automation, the following code sample will allow you to read
Dim oApp As Outlook.Application
Dim objNewMail As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim rs As DAO.Recordset

Set rs = Me.RecordsetClone
Set oApp = New Outlook.Application

Set objNewMail = oApp.CreateItem(olMailItem)
With objNewMail
rs.MoveFirst
Do While Not rs.EOF
If Len(Trim(rs!Email)) > 0 Then
Set objOutlookRecip = .Recipients.Add(rs!Email)
objOutlookRecip.Type = olTo
End If
rs.MoveNext
Loop
.Subject = "Test subject"
.Body = "Your text message here."
.Save
.Send
End With
 
Curt replied to Cheryl Fischer on 20 May 2004
Thanks I will give it a try.
I was using a macro SendObject to create the email.

however, if you are
allow you to read
source and add it to the
Email)
fine,
the
 
Cheryl Fischer replied to Curt on 20 May 2004
MSDN article on creating appointments, emails, etc., using Automation
http://tinyurl.com/2knwj

Q161088 Using Automation to Send a Microsoft Outlook Message
http://support.microsoft.com/?id=161088

HOW TO: Use Automation to Send a Microsoft Outlook Message using Access 2000
http://support.microsoft.com/?id=209948

ACC97: How to Use a Recordset to Send Outlook E-Mail to Multiple Recipients
http://support.microsoft.com/?id=318881
 

Archived message: Concatenate string limit (Microsoft Access)