T
Tony
Hello i need help
i have found this cod to send email message to members and it works fine.
is there an easy way to change the cod so i can have the members first name
put in the Body of email, ex if i send email to (e-mail address removed) and his
name is Nicklas, i would like it to write "Hello Niklas" automatic in the
body
I have a querie named [email_adress], with field and [firstname]
Option Compare Database
Option Explicit
Private Sub Email_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim sTo As String
'Build To recipient list
Set db = CurrentDb()
Set rst = db.OpenRecordset("email_adress")
rst.MoveLast 'Ensure valid count
If rst.RecordCount > 0 Then
With rst
.MoveFirst
Do While Not .EOF
sTo = sTo & ";" & ![email]
.MoveNext
Loop
End With
sTo = Right(sTo, Len(sTo) - 1) 'trim leading ;
End If
'Send Email
DoCmd.SendObject acSendNoObject, , , sTo, , , "Subject Line Goes Here",
"Email Body Text Goes Here", True
End Sub
Hope for help
Tony
i have found this cod to send email message to members and it works fine.
is there an easy way to change the cod so i can have the members first name
put in the Body of email, ex if i send email to (e-mail address removed) and his
name is Nicklas, i would like it to write "Hello Niklas" automatic in the
body
I have a querie named [email_adress], with field and [firstname]
Option Compare Database
Option Explicit
Private Sub Email_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim sTo As String
'Build To recipient list
Set db = CurrentDb()
Set rst = db.OpenRecordset("email_adress")
rst.MoveLast 'Ensure valid count
If rst.RecordCount > 0 Then
With rst
.MoveFirst
Do While Not .EOF
sTo = sTo & ";" & ![email]
.MoveNext
Loop
End With
sTo = Right(sTo, Len(sTo) - 1) 'trim leading ;
End If
'Send Email
DoCmd.SendObject acSendNoObject, , , sTo, , , "Subject Line Goes Here",
"Email Body Text Goes Here", True
End Sub
Hope for help
Tony