A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sending email to many recipients



 
 
Thread Tools Display Modes
  #1  
Old October 2nd, 2006, 11:32 AM posted to microsoft.public.access.forms
klr
external usenet poster
 
Posts: 38
Default Sending email to many recipients

I am using the following code to create an Outlook email to be sent to
a group of contacts. I get the error message 'Unknown message
recipients: message not sent' pop up when I run the code. Any ideas
why?


Private Sub SendEmail_Click()

Dim strDocName As String
strDocName = "qmt_ucas_emails"
DoCmd.OpenQuery strDocName

On Error GoTo ErrHandle

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strAddress As String
Dim strBCC As String

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("t_Account Management data",
dbOpenSnapshot)

If rst.BOF = True And rst.EOF = True Then
MsgBox "There must be an error in the query as there are no
EMail Addresses listed!"
GoTo ErrExit
End If

With rst
.MoveFirst
Do While Not .EOF
strAddress = Nz(.Fields("UCASEmail").Value, "")
If strAddress "" Then strBCC = strAddress & "; "
.MoveNext
Loop
End With

strBCC = strBCC

DoCmd.SendObject acSendNoObject, , , , , strBCC, , , True

ErrExit:
Exit Sub

ErrHandle:
MsgBox Err.description
Resume ErrExit
Resume

End Sub

  #2  
Old October 2nd, 2006, 11:59 AM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Sending email to many recipients

I doubt this is the problem, but your line of code

If strAddress "" Then strBCC = strAddress & "; "

should be

If strAddress "" Then strBCC = strBCC & strAddress & "; "

It's possible that you need to remove the final semi-colon from the string.
I also believe you must specify a To value: that you cannot simply specify a
BCC value.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"KLR" wrote in message
ps.com...
I am using the following code to create an Outlook email to be sent to
a group of contacts. I get the error message 'Unknown message
recipients: message not sent' pop up when I run the code. Any ideas
why?


Private Sub SendEmail_Click()

Dim strDocName As String
strDocName = "qmt_ucas_emails"
DoCmd.OpenQuery strDocName

On Error GoTo ErrHandle

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strAddress As String
Dim strBCC As String

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("t_Account Management data",
dbOpenSnapshot)

If rst.BOF = True And rst.EOF = True Then
MsgBox "There must be an error in the query as there are no
EMail Addresses listed!"
GoTo ErrExit
End If

With rst
.MoveFirst
Do While Not .EOF
strAddress = Nz(.Fields("UCASEmail").Value, "")
If strAddress "" Then strBCC = strAddress & "; "
.MoveNext
Loop
End With

strBCC = strBCC

DoCmd.SendObject acSendNoObject, , , , , strBCC, , , True

ErrExit:
Exit Sub

ErrHandle:
MsgBox Err.description
Resume ErrExit
Resume

End Sub



  #3  
Old October 2nd, 2006, 04:51 PM posted to microsoft.public.access.forms
klr
external usenet poster
 
Posts: 38
Default Sending email to many recipients

No this still didn't make a difference. I am baffled!

KLR

Douglas J. Steele wrote:

I doubt this is the problem, but your line of code

If strAddress "" Then strBCC = strAddress & "; "

should be

If strAddress "" Then strBCC = strBCC & strAddress & "; "

It's possible that you need to remove the final semi-colon from the string.
I also believe you must specify a To value: that you cannot simply specify a
BCC value.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"KLR" wrote in message
ps.com...
I am using the following code to create an Outlook email to be sent to
a group of contacts. I get the error message 'Unknown message
recipients: message not sent' pop up when I run the code. Any ideas
why?


Private Sub SendEmail_Click()

Dim strDocName As String
strDocName = "qmt_ucas_emails"
DoCmd.OpenQuery strDocName

On Error GoTo ErrHandle

Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strAddress As String
Dim strBCC As String

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("t_Account Management data",
dbOpenSnapshot)

If rst.BOF = True And rst.EOF = True Then
MsgBox "There must be an error in the query as there are no
EMail Addresses listed!"
GoTo ErrExit
End If

With rst
.MoveFirst
Do While Not .EOF
strAddress = Nz(.Fields("UCASEmail").Value, "")
If strAddress "" Then strBCC = strAddress & "; "
.MoveNext
Loop
End With

strBCC = strBCC

DoCmd.SendObject acSendNoObject, , , , , strBCC, , , True

ErrExit:
Exit Sub

ErrHandle:
MsgBox Err.description
Resume ErrExit
Resume

End Sub


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.