Email

peterbowles

Registered User.
Local time
Today, 22:46
Joined
Oct 11, 2002
Messages
163
I have a field in a table of 25 email address is there a function to place all those email address into the TO: field in the email window at the press of a button and also to pre state a subject and body for the message
 
DoCmd.SendObject will allow you to send the mail and has properties for the subject line, message text and To line. so all you need do is dim a string to hold the list of addressees, loop thru the table that holds the email addresses, and add a semi-colon between each address.
If you need more detail, re-post.
HTH
Chris
 
Email (Stuck)

Undertstand what you are syaing but am new at this so not sure of the code any further help would be welcomed

Thanks
 
Here's my email program...hope this helps:
Code:
Private Sub Form_Load()
Dim rsDLS As Recordset 'shows date mail was last sent
Dim rsEmail As DAO.Recordset  'the recordset with the email addresses to be used
Dim strEmail As String  'the email address
Dim strMessage As String  'message to be sent
Dim strSubject As String  'subject of message
Dim strJobNum As String  'the job posting number
Dim strJobTitle As String  'the title the job is listed under
Dim PD As Date  'the date the job was originally posted
Dim DLS As Date  'date emails were sent last
Set rsDLS = CurrentDb.OpenRecordset("tblDateLastSent") 'table where DLS is stored
rsDLS.MoveFirst 'makes sure correct record is selected
DLS = rsDLS.Fields("DateLastSent").Value  'sets value of DLS
If DLS = Date Then
Set rsDLS = Nothing
DoCmd.close  'if mail has already been sent, sub exits and form closes
Exit Sub
Else
Set rsEmail = CurrentDb.OpenRecordset("tbl27Days")  'opens table with email addresses
On Error Resume Next  'skips email addresses with errors
Do While Not rsEmail.EOF  'loops through until the end of the table
strEmail = rsEmail.Fields("E-mail").Value  'sets email address value
strJobNum = rsEmail.Fields("JobNumber").Value  'sets job number value
PD = rsEmail.Fields("PostDate").Value  'sets post date value
strJobTitle = rsEmail.Fields("JobTitle").Value  'sets job title value
strMessage = "Your job on the ISU job board, job #" & strJobNum & " entitled: " & strJobTitle & ", which was posted " & PD & ", will be removed on " & DateAdd("d", 30, PD) & " unless you contact us before that date.  Thank you.  -OSFA staff" 'message to be sent
strSubject = "Job Number " & strJobNum & " on the ISU job board"  'subject of message to be sent
DoCmd.SendObject , , , strEmail, , , strSubject, strMessage, False  'sends emails using above parameters
rsEmail.MoveNext  'goes to next record
Loop  'starts whole process over again
Set rsEmail = Nothing 'closes table
End If
DoCmd.close  'closes form when completed
End Sub
 

Users who are viewing this thread

Back
Top Bottom