473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Email from access

Hi

I hope some one can help, as i am not very good on Access
I have built a database for placing orders for customers, On the Order
Form i would like a button that would send out a email to say that the
order has been placed, then another button that order has been
despatched.
I have looked on the internet for code and found sum but do not
understand it.
As the order form only has Customer Number im not sure how to code it
to look up customers email address from tblCustomers
If any one could help i would be very greatful i am able to send the
database to you if u want to have a look but i can warn you it not
great.
Thanks
Simon

Mar 26 '06 #1
5 1543
In message <11**********************@i40g2000cwc.googlegroups .com>,
S.*******@shos.co.uk writes
Hi

I hope some one can help, as i am not very good on Access
I have built a database for placing orders for customers, On the Order
Form i would like a button that would send out a email to say that the
order has been placed, then another button that order has been
despatched.


We need a little more information. What mail software are you using. Do
you have an Outlook profile on the machine that you want to send the
mail from?

If you aren't using Outlook what mail software do you use?

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author.

Mar 26 '06 #2
I use outlook 2003 abd access 2003

If u thinl you can help please email me at s.*******@shos.co.uk and i
will give u more details and can send u the database ( its not a very
good database)
Thanks so much

Simon

Mar 26 '06 #3
S.*******@shos.co.uk wrote:
Hi

I hope some one can help, as i am not very good on Access
I have built a database for placing orders for customers, On the Order
Form i would like a button that would send out a email to say that the
order has been placed, then another button that order has been
despatched.
I have looked on the internet for code and found sum but do not
understand it.
As the order form only has Customer Number im not sure how to code it
to look up customers email address from tblCustomers
If any one could help i would be very greatful i am able to send the
database to you if u want to have a look but i can warn you it not
great.
Thanks
Simon

If you aren't needing to send any other attachments from other
applications then Docmd.SendObject is what you want.

Dim strTo As String
Dim strBody As String
Dim strSubject As String

strTo = Dlookup("EmailAddressFieldName","CustomerTableName ",_
"CustomerID = " & Me.CustomerID)
strBody = "Hello. How Are You?"
strSubject = "Test Subject"
DoCmd.SendObject acSendReport, "YourReport", acFormatTXT, _
strTo, , , strSubect, strBody, True

The above sends an email to whoever strTo is equal to. It sends a
report called YourReport. You would most likely want to send the report
that is filtered to the customer you are sending it to.

DoCmd.SendObject , , acFormatTXT, _
strTo, , , strSubect, strBody, True
will simply send an email to somebody with just subject and body, no
attachment of report or query.

Hopefully this can get you started.
Mar 26 '06 #4
Hi

Thanks very much for helping me the code work
There is still one more thing you might be able to help me with.
I have a subform within my order form that holds what product were
ordered with the order number and the quantity and price.

Is there any way how to get the information with in the subform to
apear with in the body of the email text

As i rather not have an attachment on the email
If you need me to expalin it metter give me an email as
s.*******@shos.co.uk

Mar 26 '06 #5
Ted
The strBody mentioned in the code from Salad is where you would put the
information from the sub form.
You want to write the body of the message and retrieve the information
about each item ordered and enter the information into the body of your
email.

Note: The vbCrLf you will see in this code performs a Carriage Return
and Line Feed - like pressing Enter on your keyboard.

You could build it similar to this:

'This first part sets up to allow you to read the details of the items
ordered
Dim CRS1 As ADODB.Recordset
Dim strSQL As String
Set CRS1 = New ADODB.Recordset
strSQL = "SELECT * FROM tblOrderDetails WHERE OrderID =" &
Forms!frmFormName!OrderID

'This part begins to build the body of the email
strBody = "Dear " & Forms!frmFormName!FirstName & ": " & vbCrLf &
vbCrLf
strBody = strBody & "Your order for the following items has been
receieved and has been shipped via "
strBody = strBody & Forms!frmFormName!ShipVia & " on " &
Forms!frmName!ShipDate & "."
strBody = strBody & vbCrLf & vbCrLf

'This part retrieves each item ordered and adds it to the body of the
email
CRS1.Open strSQL, CurrentProject.Connection, adOpenKeySet,
adLockReadOnly
While Not CRS1.EOF
strBody = strBody & CRS1.Fields("Qty") & " " &
CRS1.Fields("Item") & " @ " & CRS1.Fields("Price") & " Total: " & _
CRS1.Fields("Price") * CRS1.Fields("Qty") & vbCrLf
CRS1.MoveNext
Wend
CRS1.Close
Set CRS1 = Nothing

I hope this helps.

Mar 26 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: erik4x4 | last post by:
Hi, I would like to have an MS OUTLOOK email from a certain user set a record in MS ACCESS. That is everytime I get an email notification from a user, well a different database, I would like...
1
by: Lauren Quantrell | last post by:
I've been using docmd.sendobject to send e-mail using an Access 2K front end for a customer running 250 workstations. The client now has combinations of Access2K, AccessXP, Access 2003 running...
11
by: Tim Smallwood | last post by:
Hi, I have an Access project that I use to allow a client to hit an SQL server at my host. This project has several forms that are used to udpate tables, etc, but I'd also like to be able to...
7
by: Daven Thrice | last post by:
I know how to send email out of Access, and that's no problem. What I need to figure out is how to receive email into access. Say that I give access an email address, such as access@daven.com. I...
7
by: Mega1 | last post by:
is this possable to send more than 1 report in one email
24
by: Arno R | last post by:
Hi all, I have a client with several shoe-shops. Customers can leave their email-address if they want to be notified when there is a sale. Input is validated with instr() I am checking for @...
6
by: \jason via DotNetMonster.com\ | last post by:
currently i am doing a personal website and keep on changing the aspect... finally the finall decision is to have a login page (requirement in asp.net, vb.net) and the login with security part of...
10
by: Mike Charney | last post by:
Is there a simple way to send SMTP email from Access VBA? Mike m charney at dunlap hospital dot org
5
by: bobdydd | last post by:
Hi Everbody Access 2000, Windows XP, Outlook 2000, When I open my database it is set to attach to my Outlook 2000 Inbox. So far so good..... The attaching procedure works OK and I am able to...
1
by: seanhirshberg | last post by:
I have code that current sends spreadsheets by email from a user's Outlook. I need to modify the code to send the email from their group email box, so the recipient can respond to the group email....
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.