Email to multiple users

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to use SendObject to send an email with multple email addresses in the
expression. The way I'd like to use it is; The user has a number of contacts
(with email addresses) on a form/subform. From a tickbox beside each contact,
the user ticks who they want to email. They then click on command button with
the SendObject action.

Sounds simple but how do I create the string for SendObject action with all
the selected email addresses?

Any help appreciated!
Glenn
 
Glenn,
In my limited experiance with email and Access, the SendObject will allow
more than one email address, but won't let you choose. Since the users are
choosing the address before the code runs, could you set up the email address
with Option Buttons on a form? When the user choses an option, then a
command button, the code runs using the CASE.
EX: Case Opt1
DoCmd.SendObject [ObjectType], [ObjectName], [OutputFormat],
[To (enter 1st email address here)],
Case Opt2
DoCmd.SendObject [ObjectType], [ObjectName], [OutputFormat],
[To (enter 2nd email address here)],

And so on. It may seem basic, but it could work.

Donna McGoldrick
 
I do this. The only thing you will want to change is I have to deal with a
max emails issue with the clients ISP so there is a limit on the addresses
we can send in one email but if you take that inner loop out it should work

Regards

Bruce

-------------------
Public Sub EmailBuildAddressList(Optional strSubject As String, Optional
strMessage As String)
Dim strAddressList As String
Dim intAddressCount As Integer

Dim Db As DAO.Database
Dim rs As DAO.Recordset

Set Db = CurrentDb()
Set rs = Db.OpenRecordset("qryEmailSelected", dbOpenDynaset)

' There can be an issue with Telus and how many emails can be sent,
' this allows a long set of addresses to be broken up
intMaxLoops = DLookup("[MaxEmailsPerMessage]", "Admin")

'
intAddressCount = 0
With rs
If Not .EOF Then
.MoveFirst
Do Until .EOF
strAddressList = strAddressList & !Email & "; "
intAddressCount = intAddressCount + 1

' Open an email mesage each time we hit the Max emails
If intAddressCount = intMaxLoops Then
'Create the message with the recipients in the BCC: field
Call EmailSend(strAddressList, strSubject, strMessage)

' Reset the variables
intAddressCount = 0
strAddressList = ""
End If
.MoveNext
Loop

' Deal with partial list where EOF has been reached
' but we have not meet the MaxLoops yet
If intAddressCount > 0 Then
'Create the message with the recipients in the BCC: field
Call EmailSend(strAddressList, Nz(strSubject, "."), strMessage)
End If

End If
.Close
End With
Set rs = Nothing
Set Db = Nothing

End Sub
 
Back
Top