View Full Version : Email Multiple members from Access.
d239113g
01-10-2008, 12:19 PM
Hi Peeps.
I am a beginner to VBA and am really stuck with one part of an application i am making.
What i have is 1 listbox (lstEmail) with all the email addresses (variable = Email) that are in my db, and 2 text boxes (txtSubject, and txtText).
What i want to be able to do, using VBA, is for me to Type in a Subject, and a body message in the textboxes and then select 1 or multiple emails from the listbox and click a command button which will send the message to the emails selected.
I'm using Access 2003, and i am at wits end trying to figure out how to do this.
Many Thanks
J
DarkSprout
01-11-2008, 04:14 AM
Check out the post:
http://www.vbaexpress.com/forum/showthread.php?t=15524&highlight=Email
d239113g
01-13-2008, 05:08 AM
Ok .. I have been playing about with this. If i have a Text Box or a Combo box instead of the listbox i can send individual emails excluding the attachment for the time being. But If i have a listbox ...which i need. It fills the box with the email addresses from my Table, but when i try to select any and click send, It says "There is no email address shown" ? But the box is not null, as the email addresses are in the box, i can see them.
any help on this guys ?
Cheers
Private Sub sendEmail_Click()
Dim strEmail As String
If IsNull(Me.Recip) Then
MsgBox ("There is no email address shown")
Exit Sub
ElseIf Me.Recip = " " Then
MsgBox ("There is no email address shown")
Exit Sub
End If
strEmail = Me.Recip
DoCmd.SendObject , , , Me.Recip, , , Me.txtSubject, Me.txtText
Err_sendEmail:
sErr = "Error " & Error & " / " & Err
MsgBox sErr, vbInformation + vbOKOnly, "Error on Email subroutine"
End Sub
rconverse
01-13-2008, 09:13 AM
I am not sure that this will work all that well with the listbox. I have just started using this recently, so am not an expert, but might suggest the following:
If possible you can create distribution lists for the reports in Outlook and then reference them in your access code.
DoCmd.SendObject , , , "DistListRptA", , , Me.txtSubject, Me.txtText
or...
You could create a loop that runs the SendObject command for each person that is selected. If you decide to go this route and need some assistance, let me know.
HTH,
Roger
DarkSprout
01-18-2008, 04:19 AM
See attachment for an example of how to send to multible email accounts.
Enjoy,
=DarkSprout=
d239113g
01-18-2008, 03:41 PM
See attachment for an example of how to send to multible email accounts.
Enjoy,
=DarkSprout=
Many thanks.
I had got it working Using the list box and doCmd.SendOject but you cannot send attachments that way, so this is perfect thank you.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.