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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email send error

Status
Not open for further replies.

pomster

Technical User
Jan 15, 2003
88
AU
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"

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
 
Hello Pomster,

Have a look at your Close statement and try:

DoCmd.Close acForm, "YourFormName", acSavePrompt

Cheers, Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top