Send Object addition

  • Thread starter Thread starter gfischman
  • Start date Start date
G

gfischman

Guest
I have two tables set up that are related "Concept" and "Concept Document" (several Concepts together create one Concept Document). In the "Concept Document" form, I am trying to create an email message. I would like to pull the email addresses out of the "Concept" table (there will be several email addresses showing and I would like to send the text out to all). I have the Send object command set up. I am having problems pulling the "Concept" information. Any assistance would be greatly appreciated. Thanks.
 
In my database I have created a button and put this code on it


Private Sub cmdSend_Click()

Dim db As Database
Dim rs As Recordset
Dim strEmailAddress As String
Dim strSQL As String

On Error GoTo Err_cmdSend_Click

strSQL = "SELECT Members.E_mail " & _
"FROM Members " & _
"WHERE (Members.E_mail) Is Not Null"

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)

With rs
.MoveFirst
Do Until .EOF
strEmailAddress = strEmailAddress & .Fields("E_mail") & "; "
.MoveNext
Loop
End With

rs.Close

Dim stDocName As String

stDocName = "rpt_Members_List"
DoCmd.SendObject acReport, stDocName, , strEmailAddress, , , , , True

Exit_cmdSend_Click:
Exit Sub

Err_cmdSend_Click:
MsgBox Err.Description
Resume Exit_cmdSend_Click

End Sub


It queries a database a selects everyones email address's (only if they've got one) and then emails them a report.
I think that this should give you a good start.

Good Luck
 

Users who are viewing this thread

Back
Top Bottom