Sending emails from access

S

Simon

I have a form which dispalys a list of customer that is based on
query, there aer about 20 customer, what i want to do is email the
list of customer to a email address

I have a button on the form that will load up email, put correct email
address and subject in but im not sure how to make sure it dispalys
the list of customer that are on the form/ query

I have used the below code but it only displays the first customer
name and not the rest

strBody = strBody & DLookup("[FirstName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
strBody = strBody & DLookup("[LastName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf

Please could you let me know how i can display all customer name in a
list

Thanks
 
W

Wayne-I-M

Is there a reason why you dont just create a report based on the list box
(use the base query of the list as the base for the report) then use

DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title Here", "I
have attached the e mail list you wanted. If there are any problems with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) + Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""

(take off the EMailBoxCC from the code if not required)
 
S

Simon

Is there a reason why you dont just create a report based on the list box
(use the base query of the list as the base for the report) then use

        DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title Here", "I
have attached the e mail list you wanted.  If there are any problems with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) + Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""

(take off the EMailBoxCC from the code if not required)

--
Wayne
Manchester, England.



Simon said:
I have a form which dispalys a list of customer that is based on
query, there aer about 20 customer, what i want to do is email the
list of customer to a email address
I have a button on the form that will load up email, put correct email
address and subject in but im not sure how to make sure it dispalys
the list of customer that are on the form/ query
I have used the below code but it only displays the first customer
name and not the rest
strBody = strBody & DLookup("[FirstName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
strBody = strBody & DLookup("[LastName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
Please could you let me know how i can display all customer name in a
list
Thanks- Hide quoted text -

- Show quoted text -

What is wrong with this code

DoCmd.SendObject acSendReport, rptCustomersNearDealersSearch,
"RichTextFormat(*.rtf)", "Forms!frmCustomerNearDealer!Email", "", "",
" Costing Savings Report", " Test Text",False, ""
 
W

Wayne-I-M

What is wrong with this code
DoCmd.SendObject acSendReport, rptCustomersNearDealersSearch,
"RichTextFormat(*.rtf)", "Forms!frmCustomerNearDealer!Email", "", "",
" Costing Savings Report", " Test Text",False, ""


You have a few "bits" worng - try this instead

DoCmd.SendObject acReport, "rptCustomersNearDealersSearch",
"RichTextFormat(*.rtf)", Forms!frmCustomerNearDealer!Email, , "", "Costing
Savings Report", "Test textâ€, False, ""


--
Wayne
Manchester, England.



Simon said:
Is there a reason why you dont just create a report based on the list box
(use the base query of the list as the base for the report) then use

DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title Here", "I
have attached the e mail list you wanted. If there are any problems with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) + Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""

(take off the EMailBoxCC from the code if not required)

--
Wayne
Manchester, England.



Simon said:
I have a form which dispalys a list of customer that is based on
query, there aer about 20 customer, what i want to do is email the
list of customer to a email address
I have a button on the form that will load up email, put correct email
address and subject in but im not sure how to make sure it dispalys
the list of customer that are on the form/ query
I have used the below code but it only displays the first customer
name and not the rest
strBody = strBody & DLookup("[FirstName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
strBody = strBody & DLookup("[LastName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
Please could you let me know how i can display all customer name in a
list
Thanks- Hide quoted text -

- Show quoted text -

What is wrong with this code

DoCmd.SendObject acSendReport, rptCustomersNearDealersSearch,
"RichTextFormat(*.rtf)", "Forms!frmCustomerNearDealer!Email", "", "",
" Costing Savings Report", " Test Text",False, ""
 
S

sandrao

Is there a reason why you dont just create a report based on the list box
(use the base query of the list as the base for the report) then use

        DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title Here","I
have attached the e mail list you wanted.  If there are any problems with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) + Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""

(take off the EMailBoxCC from the code if not required)

--
Wayne
Manchester, England.



Simon said:
I have a form which dispalys a list of customer that is based on
query, there aer about 20 customer, what i want to do is email the
list of customer to a email address
I have a button on the form that will load up email, put correct email
address and subject in but im not sure how to make sure it dispalys
the list of customer that are on the form/ query
I have used the below code but it only displays the first customer
name and not the rest
strBody = strBody & DLookup("[FirstName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
strBody = strBody & DLookup("[LastName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
Please could you let me know how i can display all customer name in a
list
Thanks- Hide quoted text -

- Show quoted text -

Is there anyway to use the code:
DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title
Here", "I
have attached the e mail list you wanted. If there are any problems
with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) +
Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""

without, Some Title Here, I have attached the e mail list you
wanted. If there are any problems with
this report please contact me, Simon and My Phone Number is ###",

I would manly would like to code to have the name of report and just
select the email addresses with a subject line

Sandrao
 
S

sandrao

Is there a reason why you dont just create a report based on the list box
(use the base query of the list as the base for the report) then use
        DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title Here", "I
have attached the e mail list you wanted.  If there are any problems with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) + Chr(10)&
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""
(take off the EMailBoxCC from the code if not required)
Simon said:
I have a form which dispalys a list of customer that is based on
query, there aer about 20 customer, what i want to do is email the
list of customer to a email address
I have a button on the form that will load up email, put correct email
address and subject in but im not sure how to make sure it dispalys
the list of customer that are on the form/ query
I have used the below code but it only displays the first customer
name and not the rest
strBody = strBody & DLookup("[FirstName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
strBody = strBody & DLookup("[LastName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
Please could you let me know how i can display all customer name in a
list
Thanks- Hide quoted text -
- Show quoted text -

Is there anyway to use the code:
 DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title
Here", "I
have attached the e mail list you wanted.  If there are any problems
with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) +
Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""

without,  Some Title Here, I have attached the e mail list you
wanted.  If there are any problems with
this report please contact me, Simon and My Phone Number is ###",

I would manly would like to code to have the name of report and just
select the email addresses with a subject line

Sandrao- Hide quoted text -

- Show quoted text -

One other question would this code be capable of sending an attachment
to 25 email addresses?
If i needed to send to more addresses than mentioned above what would
be needed?
 
W

Wayne-I-M

DoCmd.SendObject acReport, "E Maill addres from form",
"RichTextFormat(*.rtf)", Forms!frmCustomerNearDealer!Email, , "", "E Mail
title", "E mail body textâ€, False, ""

You don't need the report name in the e mail as it will be shown in the
attatchment heading - but you could includeit in either the tital or the body
if you really wanted




--
Wayne
Manchester, England.



sandrao said:
Is there a reason why you dont just create a report based on the list box
(use the base query of the list as the base for the report) then use

DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title Here", "I
have attached the e mail list you wanted. If there are any problems with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) + Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""

(take off the EMailBoxCC from the code if not required)

--
Wayne
Manchester, England.



Simon said:
I have a form which dispalys a list of customer that is based on
query, there aer about 20 customer, what i want to do is email the
list of customer to a email address
I have a button on the form that will load up email, put correct email
address and subject in but im not sure how to make sure it dispalys
the list of customer that are on the form/ query
I have used the below code but it only displays the first customer
name and not the rest
strBody = strBody & DLookup("[FirstName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
strBody = strBody & DLookup("[LastName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
Please could you let me know how i can display all customer name in a
list
Thanks- Hide quoted text -

- Show quoted text -

Is there anyway to use the code:
DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title
Here", "I
have attached the e mail list you wanted. If there are any problems
with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) +
Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""

without, Some Title Here, I have attached the e mail list you
wanted. If there are any problems with
this report please contact me, Simon and My Phone Number is ###",

I would manly would like to code to have the name of report and just
select the email addresses with a subject line

Sandrao
 
W

Wayne-I-M

No this code will only e mail to a few people Mail + CC + BCC etc

Go to www.rogersaccesslibrary.com and download his excelent ziped smaple
database to see how to run the reports to multiple address's




--
Wayne
Manchester, England.



sandrao said:
Is there a reason why you dont just create a report based on the list box
(use the base query of the list as the base for the report) then use
DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title Here", "I
have attached the e mail list you wanted. If there are any problems with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) + Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""
(take off the EMailBoxCC from the code if not required)
:
I have a form which dispalys a list of customer that is based on
query, there aer about 20 customer, what i want to do is email the
list of customer to a email address
I have a button on the form that will load up email, put correct email
address and subject in but im not sure how to make sure it dispalys
the list of customer that are on the form/ query
I have used the below code but it only displays the first customer
name and not the rest
strBody = strBody & DLookup("[FirstName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
strBody = strBody & DLookup("[LastName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
Please could you let me know how i can display all customer name in a
list
Thanks- Hide quoted text -
- Show quoted text -

Is there anyway to use the code:
DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title
Here", "I
have attached the e mail list you wanted. If there are any problems
with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) +
Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""

without, Some Title Here, I have attached the e mail list you
wanted. If there are any problems with
this report please contact me, Simon and My Phone Number is ###",

I would manly would like to code to have the name of report and just
select the email addresses with a subject line

Sandrao- Hide quoted text -

- Show quoted text -

One other question would this code be capable of sending an attachment
to 25 email addresses?
If i needed to send to more addresses than mentioned above what would
be needed?
 
S

sandrao

No this code will only e mail to a few people Mail + CC + BCC etc

Go towww.rogersaccesslibrary.comand download his excelent ziped smaple
database to see how to run the reports to multiple address's

--
Wayne
Manchester, England.



sandrao said:
On Jun 21, 2:23 pm, Wayne-I-M <[email protected]>
wrote:
Is there a reason why you dont just create a report based on the list box
(use the base query of the list as the base for the report) then use
        DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some TitleHere", "I
have attached the e mail list you wanted.  If there are any problems with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) + Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""
(take off the EMailBoxCC from the code if not required)
--
Wayne
Manchester, England.
:
I have a form which dispalys a list of customer that is based on
query, there aer about 20 customer, what i want to do is email the
list of customer to a email address
I have a button on the form that will load up email, put correct email
address and subject in but im not sure how to make sure it dispalys
the list of customer that are on the form/ query
I have used the below code but it only displays the first customer
name and not the rest
strBody = strBody & DLookup("[FirstName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
strBody = strBody & DLookup("[LastName]",
"qryCustomersNearDealersSeach", "[DealerLocationID]=" &
Me.DealerIDSearch) & vbCrLf
Please could you let me know how i can display all customer name in a
list
Thanks- Hide quoted text -
- Show quoted text -
Is there anyway to use the code:
 DoCmd.SendObject acReport, "NameOfReport", "RichTextFormat(*.rtf)",
Forms!FormName!EMailBox, Forms!FormName!EMailBoxCC, "", "Some Title
Here", "I
have attached the e mail list you wanted.  If there are any problems
with
this report please contact me." & Chr(13) + Chr(10) & Chr(13) +
Chr(10) &
"Simon" & Chr(13) + Chr(10) & "My Phone Number is ###", False, ""
without,  Some Title Here, I have attached the e mail list you
wanted.  If there are any problems with
this report please contact me, Simon and My Phone Number is ###",
I would manly would like to code to have the name of report and just
select the email addresses with a subject line
Sandrao- Hide quoted text -
- Show quoted text -
One other question would this code be capable of sending an attachment



Got this code but still have a problem
Private Sub SendAll_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset

Dim strTo As String

Set db = CurrentDb()
Set rs = CurrentDb.OpenRecordset("Emailer", dbOpenSnapshot)

With rs
Do While Not .EOF
strTo = !Email & ";" & strTo
.MoveNext
Loop
End With

DoCmd.SendObject acReport, Me.txtReport, acFormatRTF, strTo

rs.Close
Set rs = Nothing
Set db = Nothing

End Sub

getting error 2501 then Sendobject canceled..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top