I am trying to send an email to multiple recipients from an access form. My code was working fine until I tried to move the recipients to the bcc field. It all works fine but gives me an error at the end.
"An expression you entered is the wrong data type for one of the arguments"
I haven't touched Access for about 18 months now and am somewhat rusty.
Any help would be appreciated.
Regards,
David
"An expression you entered is the wrong data type for one of the arguments"
Code:
Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click
Dim strEmail As String
Dim strMailSubject As String
Dim strMsg As String
Dim strSecretary As String
strSecretary = Me.Sec & vbNullString
strEmail = Me.txtSelected & vbNullString
strMailSubject = Me.txtMailSubject & vbNullString
strMsg = Me.txtMsg & vbNullString & vbCrLf & vbCrLf & "blah" & vbCrLf & _
vbCrLf & "MailTo:blah@hotmail.com"
DoCmd.SendObject _
, _
, _
, _
strSecretary, _
, _
strEmail, _
strMailSubject, _
strMsg, _
True
DoCmd.Close , Form_Frm_Email, acSavePrompt
Exit_cmdEmail_Click:
Exit Sub
Err_cmdEmail_Click:
MsgBox Err.Description
Resume Exit_cmdEmail_Click
End Sub
I haven't touched Access for about 18 months now and am somewhat rusty.
Any help would be appreciated.
Regards,
David