Complex Email from contact List

me_ntal

Registered User.
Local time
Today, 15:27
Joined
Jun 22, 2011
Messages
13
Ok heres my simple verison

Contact list is stored in a table called "Contacts"
Column1
ID
Column2
Company Name
Column3
Email address
The Button [admin] is on the form [Plant]

The report template is called [Mailout]
It has a in built query
column 2 is controlled by one factor
column 3 is controlled by this new function


This function will cycle through the client list
Each time generating a unique report controlled by column 2
Emailing it to the Clients email.

Any ideas?
 
  1. DO NOT double-post the same issue. Delete the first one, or close it by adding a link to that post to this one, with a comment that the discussion continues here.
  2. Ideas on what specifically? Are you saying "Please write the code for me" ? You may get lucky and someone will do that. Otherwise be specific as to what your problem is. A huge number of posts here deal with mailing from Access. Do a search either using the search menu item at the top of the page, or by googling this site, or simply by skimming through the recent posts
 
Whats the forums policy on feeding trolls?

Two different forums.
One is VBA, One is Macro.
Maybe an expert in only one field could solve it?

Im not having trouble with mailout as of yet.

I want a way to set a loop through a button
that will increase the row id of a table, Run a query, Generate a report that is from the query from column, and mail it to the email in column three of table.

Yes an example code would be great.

My general idea is

Do until (x=listmax)


listmax=listmax+1
Loop
 
Last edited:
Take a look at this code to see if it helps you.

I have created a database which is used to send out invitations and I use a form with fields in, then run a query in the background it loops through each record to send out individual emails. You will need to add a Reference to use Outlook. Use Alt + F11 and then Tools > Reference > search down the list until you find Microsoft Outlook XX Object Library tick the box

Private Sub CmdPressemail_Click()
Dim olapp As Outlook.Application
Dim olmailmessage As Outlook.MailItem
Dim olrecipient As Outlook.Recipient

Dim StrMsg As String

Dim rcdSQL As Variant

Dim db As DAO.Database
Dim rcd As Recordset

Set db = CurrentDb()

Set rcdSQL = db.OpenRecordset("SELECT * FROM qryEmailAwaitingResponseEastMidlands WHERE [AwardEventAttendance]='East Midlands'")

Set olapp = New Outlook.Application


Do Until rcdSQL.EOF

If rcdSQL!.Value <> "" Then
Set olmailmessage = olapp.CreateItem(olMailItem)

olmailmessage.Recipients.Add (rcdSQL![Email].Value)

olmailmessage.Subject = Me.txtsubject.Value
olmailmessage.Body = Me.txtbody.Value & vbCrLf




'If blnKnownRecipient = True Then
olmailmessage.Send
Set olmailmessage = Nothing
End If
rcdSQL.MoveNext


Loop
'olapp.Quit
Set olapp = Nothing
End Sub[/QUOTE]
 
#3 Your reply has been noted, also the fact that you did not do what you were requested to do. I have reported your post, and then we'll see what the forum policy on trolls is.
 
Please only a question on the same matter in one forum. If you are unsure, you can post in the general forum and someone can move it as appropriate.

Thanks!
 

Users who are viewing this thread

Back
Top Bottom