SendObject problem

  • Thread starter Thread starter dennis g
  • Start date Start date
D

dennis g

Guest
Access97. Have code that send email to whatever address user clicks on in listbox. Most of addresses in the list box pertain to only one address (many are network printers). However; on address in particular contains 100 email address. I can copy/paste all 100 into the To: box in Outlook, but when I select it in the list box, only about 10 of the addresses go in the box. Code is below:

On Error GoTo Err_Command1
Dim ctl As Control
Dim varItm As Variant
Dim stString As String

Set ctl = Me!List63
For Each varItm In ctl.ItemsSelected
stString = stString & IIf(stString = "", "", ";") & ctl.Column(1, varItm)
Next varItm
'MsgBox stString

DoCmd.SendObject , , , stString, , , _
"MILITARY MOVEMENT: " & Me.file_number, "SHIPPER: " & Me.shipper & vbCrLf & vbCrLf & "FILE: " & Me.file_number & vbCrLf & "ROUTING:" & Me.routing & vbCrLf & vbCrLf & "LADING: " & Me.lading & vbCrLf & _
"LOAD(S): " & Me.load & vbCrLf & "ORIGIN: " & Me.origin & vbCrLf & "DESTINATION: " & Me.destination & vbCrLf & vbCrLf & "TRACKING HISTORY: " & vbCrLf & Me.history, True


Exit_Command1:
Exit Sub
Err_Command1: ' This is the label
'MsgBox Err.Number & Err.Description
If Err.Number = 2501 Then
MsgBox "You Haven't Sent This Message", vbOKCancel, "UP Military Movement Notice"
Resume Exit_Command1
End If
Resume Exit_Command1

Can anyone see why it only picks up part of the field? It cuts off at exactly 255 characters. Is that the maximum length I can use? The field in the table is defined as Memo.
 
dennis g, why not use group mailing instead of trying to put each email in the To: field of Outlook. If you are using Exchange server you probably already have some distribution groups set up.
 
Talismanic: The short answer to that is: Exchange admn won't allow it. I already asked.....You can't store internet email addresses in the personal mailbox, at least not on our system. You have to store them in the system directory, and they said NO. We are low on the totem pole around here....
 
Talismanic: The short answer to that is: Exchange admn won't allow it. I already asked.....You can't store internet email addresses in the personal mailbox, at least not on our system. You have to store them in the system directory, and they said NO. We are low on the totem pole around here....
 
dennis g, unless some one posts with a better solution you may try taking the addresses from a table or query and then looping through the recordset and using the SendObject in the loop like this:

Dim rsEmail As DAO.Recordset
Dim strEmail As String
Set rsEmail = CurrentDb.OpenRecordset("YourQuery")

Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("EmailAddress").Value
DoCmd.SendObject , , , strEmail, , , "Subject", "Message Text"

rsEmail.MoveNext

Loop
Set rsEmail = Nothing
 

Users who are viewing this thread

Back
Top Bottom