Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to send email to a group of contacts in a table in Access 97 1

Status
Not open for further replies.

nalbiso

Programmer
Aug 31, 2000
71
0
0
US
Please help!

I am trying to email a report to a group of contacts in a table.

But when I use the following code:

Private Sub cmdsendjobopps_Enter()
DoCmd.SendObject acSendReport, "jobopps", acFormatRTF, Me![Email Address], , , "Current Job Opportunities for Classified Personnel", , -1
End Sub

Only one of the contacts shows up in the Send To: box.

I would appreciate any help!
[sig][/sig]
 
Hi!

Use DAO
In the VBA, go to Tools | References
Check the Microsoft DAO 3.N Object Library (N-numeric, possibly 6)

When declaring variables, use:
Dim db As DAO.Database
Dim rs As DAO.Recordset
to avoid anomalities

(You should also alter all your ADO declarations to
Dim rs as ADODB.Recordset ' etc

HTH Roy-Vidar
 
Putting all this together, I get:

Private Sub cmdsendjobopps_Enter()

Dim db as Database, rst as Recordset
Dim strSQL as String
Dim Names as String

Set db = CurrentDb
strSQL = "SELECT[joblist Email List].[Email Address]FROM[Joblist Email List;"
Setrst=db.OpenRecordset(strSQL)

With rst
.movefirst
names=![email address]&";"
.movenext
do until.EOF
names=names&![Email Address}&";"
.movenext
loop
end with

DoCmd.SendObject acSendReport, "jobopps", acFormatRTF, Names,,,"Current Job Opportunities for Classified Personnel",,-1

End Sub


Following the above gives me a error where the "To:" field in the e-mail message will not fill in with any of my e-mail addresses. Any suggestions? I assume that:

"Joblist Email List" is a table or form
"Email Address" is a field in the table or form
"jobopps" is the report
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top