My Assistant
![]() ![]() |
|
|
Apr 17 2012, 09:41 PM
Post
#1
|
|
|
UtterAccess Member Posts: 20 |
Hi,
I have a request which needs to group in a single email all of records that belongs a specific customer. Each customer might have multiple contacts(emails) to be sent. All of the records needs to be categorized and group by customer. I just found this code and works except for the following: 1. Always asked me about security stuff. 2. I just can email one record at a time and I cannot group all of records in a single email for each customer. Would you mind to help me guys about it. I have included a copy of the query table. Thanks. Private Sub Command0_Click() Dim MyDb As DAO.Database Dim rsEmail As DAO.Recordset Dim sToName As String Dim sSubject As String Dim sMessageBody As String Set MyDb = CurrentDb() Set rsEmail = MyDb.OpenRecordset("Query1", dbOpenSnapshot) With rsEmail .MoveFirst Do Until rsEmail.EOF If IsNull(.Fields(7)) = False Then sToName = .Fields(7) sSubject = "SO #: " & .Fields(1) sMessageBody = "Estimado cliente adjunto encontrara la informacion de la orden" & vbCrLf & _ "Cliente: " & .Fields(0) & vbCrLf & _ "Numero de Orden: " & .Fields(1) & vbCrLf & _ "Numero de Ship set: " & .Fields(2) & vbCrLf & _ "Numero de Linea de Orden: " & .Fields(3) & vbCrLf & _ "Pais de origen: " & .Fields(4) & vbCrLf & _ "Lugar de embarque: " & .Fields(5) '"Field C: " & .Fields© DoCmd.SendObject acSendNoObject, , , _ sToName, , , sSubject, sMessageBody, False, False End If .MoveNext Loop End With Set MyDb = Nothing Set rsEmail = Nothing End Sub This post has been edited by gfranco: Apr 17 2012, 09:42 PM
Attached File(s)
|
|
|
|
Apr 19 2012, 10:23 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 5,115 From: Dunbar, WV |
You're looping through the customers but you need an inner loop through the transactions.
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 22nd May 2013 - 08:58 PM |