SendObject error

D

Donna Watling

I'm using SendObject to create an email concatenating Email addys from a table.

This is my code:

Dim rs1 As DAO.Recordset
Dim sEmail As String

stSQL = "SELECT FROM tblPerson WHERE (((tblPerson.PracticeID) = " & Me.PracticeID & " ))"

Set rs1 = CurrentDb.OpenRecordset(stSQL, dbOpenSnapshot, dbSeeChanges)

sEmail = ""

Do
sEmail = sEmail & rs1!Email & ";"
rs1.MoveNext
Loop Until rs1.EOF

rs1.Close

DoCmd.SendObject , , , sEmail, , , "Ipswich Diabetes Centre Newsletter", "Attached is a copy of the etc ...", -1

I'm getting the error message:
The command or action 'SendObject' isn't available now.

Any ideas?
 
T

TF

Could it be that the email string should have commas instead of semicolons?
The SendObject error might be generically telling you that the email cannot go due to the email address(es) being wrong.
Also, you might want to make sure the LAST email in the string does not have any comma (or semicolon).

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top