View Full Version : Email generated by check box


Clearsky24
03-12-2003, 08:58 AM
Here is where I stand, I know so little that I don't know if I am posting to the right category, I know this is possible, and probably relatively easy, where do I find info on this.

I have 2 tables in an access data base, Orders and Customers

The Orders table contains a yes/no check box in the field named Charged

When that yes or no check box is clicked, I want it to pop up an email, the invoice number is Key because the same customer could have multiple orders.
The email would have the following info:

Email address in TO: [CustomersTable;EmailAddress]
Subject: Invoice from ClearSky24 for Digitizing

Body:
Clearsky24
1920 Abrams Pkwy #318
Dallas, TX 75214
800 895 6360
info@clearsky24.com

Customer name: [CustomersTable;CompanyName]

Account Number: [CustomersTable;CustomerID]

PO Number: [OrdersTable;PurchaseOrderNumber]

Invoice Number: [OrdersTable;Invoice]

Logo Name: [OrdersTable;ProductDescription]

Amount Charged: [OrdersTable;UnitPrice]


Thank you for your business!!!
Please see Terms of Service or Pricing page of our website http://www.clearsky24.com/ for details on our policies, If there is a problem with the logo, our policy is to correct it and make you happy.

charityg
03-13-2003, 02:37 PM
First, you'll have to design a form for this. You can't fire an event (make something happen) from a table.

When you get the form setup, you can use the click event for the checkbox to send the email with the DoCmd.SendObject command.

Let's take this in baby steps. First create the form to display the information. This should probably be a main form for the customer information and a subform for the Orders table.

Clearsky24
03-13-2003, 04:26 PM
That is exactly what I have,
I love baby steps

charityg
03-14-2003, 06:22 AM
In the click event of the check box, use the following code

dim strMessage as string

strMessage="Clearsky24" & Chr(13) & "1920 Abrams Pkwy #318" & chr(13) & "Dallas, TX 75214 " & chr(13) & "800 895 6360" & chr(13) & "info@clearsky24.com" & chr(13) & chr(13) & "Customer Name: " & forms!MainformName!CompanyName & chr(13) & chr(13) & "Account Number: " & forms!MainformName!CustomerID & chr(13) & chr(13) & "PO Number: " & me!PurchaseOrderNumber & Chr(13) & chr(13) & "Invoice Number: " & me!Invoice & chr(13) & chr(13) & "LogoName: " & me!ProductDescription & chr(13) & chr(13) & "Amount Charged: " & me!UnitPrice & chr(13) & chr(13) & "Thank you for your business!!!" & chr(13) & "Please see Terms of Service or Pricing page of our website http://www.clearsky24.com/ for details on our policies, If there is a problem with the logo, our policy is to correct it and make you happy."

docmd.SendObject acSendNoObject,,,forms!MainFormName!EmailAddress,c c,bcc,"Invoice from ClearSky24 for Digitizing",strMessage,false

chr(13) is a hard carriage return
MainFormName is name of the main form which should have your customer information
the false parameter in the SendObject command makes the email send automatically without editing.

Clearsky24
03-14-2003, 07:05 AM
I don't know what makes people be so nice that come to this site maybe it's for their charma, maybe you were a bad person in a previous life and are trying to make up for it,

Thank you so much!!!!
It works like a charm.

charityg
03-14-2003, 07:07 AM
Your very welcome. I come to this forum normally because I'm bored with my current project, and this gives me something different to do, and keeps me sharp. Also, I remember not so long ago when I struggled with Access and this forum was invaluable to me. I'm just giving back.