Sending Email

aftershokk

Registered User.
Local time
Today, 17:42
Joined
Sep 5, 2001
Messages
259
On the send object TO: line, I cannot get Access to recognize sending an email to multiple addresses. I have tried a comma and a semicolon. I have tried single quotes and double qoutes. When I convert the macro to VB it displays as follows.

"myemai@123.com;myemai2@123.com"

It picks the first email from above and sends it but ignores the second email. I have tried editing the VB also with no luck.

HELP!

thanks
 
Where does Access get its email addresses from and how many addresses do you require?

Simon
 
reply

I type the addresses into the macro.

I need to send it to 8 people.
 
Then use the SendObject (search this forum) you may need to reiterate a SendObject for each recipient in your Macro. ie SendObject x 8. I only use the SendObject for single emails otherwise I use a VB script and a SQL statement.

Simon
 
reply

I tired modifying the VB I displayed but still no luck. Did I miss some syntax?
 
What's your code? I've sent email to multiple recipients with no problems.
 
I did it with a form where I could enter the email addresses and I inputted them with a comma separating them and the code worked fine:
Code:
    DoCmd.SendObject acSendReport, "rptOrders", acFormatXLS, Me.Text0, , , , "Here's your report.", True
 
reply

Option Compare Database

'------------------------------------------------------------
' Macro2
'
'------------------------------------------------------------
Function Macro2()
On Error GoTo Macro2_Err

DoCmd.SendObject acQuery, "Final Effective Changes Rpt", "MicrosoftExcelBiff8(*.xls)", "janedoe@123.org,johndoe@123.org", "mary@123.org", "jim@123.org", "subject line", "email body text", False, ""


Macro2_Exit:
Exit Function

Macro2_Err:
MsgBox Error$
Resume Macro2_Exit

End Function
 
Two things -

change this: "MicrosoftExcelBiff8(*.xls)

To this acFormatXLS

And get rid of the last comma and quotations as you don't need to put those in for optional items. You should just leave it blank. So the last thing on your line should be TRUE.
 
reply

error message

An expression you entered is the wrong data type fpr one of the arguments

see code below

Option Compare Database

'------------------------------------------------------------
' Macro2
'
'------------------------------------------------------------
Function Macro2()
On Error GoTo Macro2_Err

DoCmd.SendObject acQuery, "Final Effective Changes Rpt", "acFormatXLS", "jdoe@123.com", "jdoe@123.com", "jdoe@123.com", "jdoe@123.com", "subject line", "body text", True


Macro2_Exit:
Exit Function

Macro2_Err:
MsgBox Error$
Resume Macro2_Exit

End Function
 
error message

An expression you entered is the wrong data type fpr one of the arguments

see code below

Option Compare Database

'------------------------------------------------------------
' Macro2
'
'------------------------------------------------------------
Function Macro2()
On Error GoTo Macro2_Err

DoCmd.SendObject acQuery, "Final Effective Changes Rpt", "acFormatXLS", "jdoe@123.com", "jdoe@123.com", "jdoe@123.com", "jdoe@123.com", "subject line", "body text", True


Macro2_Exit:
Exit Function

Macro2_Err:
MsgBox Error$
Resume Macro2_Exit

End Function

You don't have the email addresses with the commas outside the quotes, you need one quote set with the email addresses in the string. To better see what I mean do it this way:

Code:
Dim strEmailAddresses As String

strEmailAddresses = "jdoe@123.com, jdoe@123.com, jdoe@123.com, jdoe@123.com"

DoCmd.SendObject acQuery, "Final Effective Changes Rpt", "acFormatXLS", strEmailAddresses, "subject line", "body text", True
 
I forgot to fix that you had quotation marks around the format and since it is an ACCESS CONSTANT, it has NO quotes around it. It is simply:

acFormatXLS
 
I hope this isn't a really stupid question but apologies if it is!

I have a form with an E-Mail button on it that I want to send an e-mail to the person whose e-mail address shows on that same form. The form has an e-mail address field simply called "Email"

Using this code;
DoCmd.SendObject acReport, stDocName, "Snapshot Format", , , , , "Booking Sheet", "Attached is your booking sheet.

is it possible to have the "To Email" part of ot code look at the "Email" field on the form "frmBooking"

Cheers again - I am learning.
 
Sure; simply place this in that argument:

Forms!frmBooking.Email
 
E-mail

Thanks - This works but doesn't. :(

When I press the button for the e-mail, the ID number shows in the "Address Line" of Outlook, not the actual e-mail address. The e-mail address is what is visible on the form.

Thanks again, Scott.
 
Then your control is probably a combo box, eh? So then you would use

Forms!frmBooking.Email.Column(1)
 
Truely Awesome

[FONT=&quot]Thanks again! You guys are truly awesome and deserve many more thanks that what is visible on this forum! Thanks again. :)[/FONT]
 
GladWeCouldHelp.png

2-Thumbs_up.png
 

Users who are viewing this thread

Back
Top Bottom