|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Email Distribution Lists, etc.
In my table, I have email address stored for most of the entries. I could add another field to determine which type of email they would receive.
I set one up as a hyperlink and when I clicked on it, it opened up and email and populated the address for me. I know this is common knowledge but here's the question... What would be the easiest way to call up all the addresses in a certain category and have all of them populated into a blank email as blind copy, with the subject, from, and body populated as well? Thanks in advance |
|
#2
|
|||
|
|||
|
Hi krisw538,
First create a query that is filtered by your requirements (i.e. certain category). The following code can be put behind a command button on a form for example: Private Sub cmdEmail_Click() On Error GoTo Err_Handler Dim db As DAO.Database Dim rs As DAO.Recordset Dim strTo As String, strCC As String, strBCC As String Dim strSubject As String, strMessage As String strTo = "recipient@someaddress.com" 'Address to send to (required) strCC = "recipient@someaddress.com" 'Address to copy to (optional) strSubject = "This is your Subject Line" strMessage = "This is your Message Text" Set db = CurrentDb Set rs = db.OpenRecordset("qryName", dbOpenSnapshot) Do Until rs.EOF With rs If Not IsNull(rs!Email) Then 'Make sure that an email address exists strBCC = strBCC & rs!Email & "; " End If .MoveNext End With Loop strBCC = Left(strBCC, Len(strBCC) - 2) 'Addresses to Blind copy to Set db = Nothing Set rs = Nothing DoCmd.SendObject , , , strTo, strCC, strBCC, strSubject, strMessage Exit_Handler: Exit Sub Err_Handler: If Err.Number = 2501 Then 'In case the email was canceled Resume Exit_Handler Else MsgBox Err.Number & " " & Err.Description Resume Exit_Handler End If End Sub You would change what is bold above to the exact name of the query you created and use the exact name of the field that holds the email addresses. Be sure you have the references set to the DAO library under Tools/References while in your forms code module. The above code will not validate the email addresses so it would be up to you to make sure that a valid email address was entered correctly into the table. lwells |
|
#3
|
|||
|
|||
|
Thank you, I'll try it out
|
|
#4
|
|||
|
|||
|
Thank you so much, this worked great!
I only have one question about it. How would I go about making it use no more than 70 email addresses at a time since aol won't allow for mass emailing. At the end of 70 email addresses, have it open another email form with same information but using the next group of 70? Thanks in advance, Kris Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Email Distribution Lists, etc. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|