Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Address Truncation Issue 1

Status
Not open for further replies.

MikeC14081972

Programmer
May 31, 2006
137
GB
I have an access db (2000) which is used for sending emails via Lotus Notes.

I'm building a string of email address from a recordset based on a table.

When passing the string (SendTo) to Lotus notes using
Code:
objNotesDoc.ReplaceItemValue "SendTo", SendTo

The string is being cut short. However if I step through the code and after the string has been compiled i view the string
Code:
?SendTo

The complete string is shown. I now it's not an issue with the length of string allowed by Notes as I can cut and paste the string from the Imediate window to Notes with no issues.

Anyone got any ideas?????

Thanks
 
Is it possible that there are "gaps" in the string? Outlook can get upset with, for example:

Name;;Name
 
Remou thanks for the quick reply.

Yes the last email address being truncated does have spaces.

Any idea how to get round this?
 
I am not sure, but Trim or Replace may suit.
 
Can you post a short sample string with a little code? You will need to replace the actual addresses with something innocuous, a@a.a, for example.
 
Here's the code that builds the string

Code:
strRecipient = "SELECT DISTINCT tbl_FMBooks.Notifications " _
                      & "FROM (tbl_FMEntity INNER JOIN tbl_FMBooks ON tbl_FMEntity.Level7Name = tbl_FMBooks.Level7) " _
                      & "INNER JOIN tbl_Holdings ON tbl_FMBooks.Book_Number = tbl_Holdings.Book_Number " _
                      & "WHERE (((tbl_FMEntity.Level7Name)= '" & rsBusArea.Fields("level7name") & "') AND " _
                      & "((tbl_Holdings.[Notification ID])='" & NtID & "'))"
        
        Set rsRecipient = db.OpenRecordset(strRecipient)
        
        strRecipient = ""
        
        Do While (Not rsRecipient.EOF)
            If SendTo <> "" Then
                If Right(SendTo, 1) = "," Then
                    SendTo = SendTo & rsRecipient.Fields(0)
                Else
                    SendTo = SendTo & "," & rsRecipient.Fields(0)
                End If
            Else
                SendTo = rsRecipient.Fields(0)
            End If
  rsRecipient.MoveNext
        Loop
        
        If Right(SendTo, 1) <> "," Then
            SendTo = SendTo & ","
        End If

Email address are taken from a table, will changing these help incase the address is the issue?
 
I am not sure why you need the final comma. In Outlook addresses are separated by semi-colons.

I can only guess at the cause of the problem. It would be worth trying with a set, sample list or a very small recordset (SELECT Top 10).
 
The issue was occuring without the comma, but that in as a trial to see if made a difference just haven't removed it yet.

Have come up with a manual work around for now and will post back if I find a solution.

Thanks for your help, have a star
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top