Private Sub cmdSendEmail_Click()
Form_frmInput_Contact_Info.Visible = False
Dim dbD As DAO.Database
Dim rsR As DAO.Recordset
Dim strAddresses As String
Set dbD = CurrentDb()
DoCmd.OpenQuery "qryAllEmailAddresses"
MsgBox "Please select your email recipients" & vbCrLf & _
"by checking the appropriate boxes.", , "Let's Email Someone!"
If vbOK = 1 Then
'hold program to make selections.
'then continue on.
Set rsR = dbD.QueryDefs("qrySelectedEmailAddresses").OpenRecordset(dbOpenSnapshot)
Do Until rsR.EOF
With rsR.Fields("E-Mail Address")
If Not IsNull(.Value) Then
strAddresses = strAddresses & "; " & .Value
rsR.MoveNext
End If
End With
Loop
rsR.Close
Set rsR = Nothing
Set dbD = Nothing
strAddresses = Mid(strAddresses, 3)
If Len(strAddresses) > 0 Then
On Error GoTo ErrorTrap
DoCmd.SendObject _
ObjectType:=acSendNoObject, ObjectName:="", OutputFormat:= _
acFormatTXT, To:=strAddresses, Cc:="", Bcc:="", Subject:= _
"", MessageText:="", EditMessage:=True, TemplateFile:=""
MsgBox "Message successfully sent."
If vbOK = 1 Then
Form_frmInput_Contact_Info.Visible = True
End
End If
End If
Exit Sub
ErrorTrap:
MsgBox "There are no cotacts for the selected query"
If vbOK = 1 Then
Form_frmInput_Contact_Info.Visible = True
End
End If
End If
End Sub
--
HTH,
Steve Clark, Access MVP
Project Manager
Professional Solutions Group
www.FMSInc.com/Consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"AT" <ato...@cox.net> wrote in message
news:41fc24e8.02102...@posting.google.com...