473,326 Members | 2,134 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,326 software developers and data experts.

access form with checkbox if true (box is ckecked) then send email using Outlook

I have a couple of forms that track the status of our orders. In both forms I would like to update a date field in a table as the data the checkbox was checked as well as send an email to the customer about the status of their order. As a bonus (not really necessary) I would like to blank out the date field if the box is UnChecked.

One form is based on the table that contains the field I want updated but the 2nd form is based on a query. The query has no joins so it produces an updatable recordset.
Jun 17 '14 #1

✓ answered by twinnyfo

slburke67,

Welsome to Bytes!

You don't provide much information for us to go on. Do you want the e-mail to be sent immediately after the check box is checked? That is somewhat of a strange methodology, but I understand how it can work that way.

The basics of ryour code would be similar to this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub chkCheckBoxName_AfterUpdate()
  2.     If Me.chkCheckBoxName = True Then
  3.         'Update your Date Fields
  4.         Forms!FormName1.txtDateField1 = Now()
  5.         Forms!FormName2.txtDateField2 = Now()
  6.         'Send the E-Mail - many methods to do this...
  7.         DoCmd.SendObject [blah blah blah]
  8.     Else
  9.         'Update your Date Fields
  10.         Forms!FormName1.txtDateField1 = Null
  11.         Forms!FormName2.txtDateField2 = Null
  12.     End If
  13. End Sub
Those are the basics, but without more information, I am flying blind.

Hope this hepps!

5 4424
twinnyfo
3,653 Expert Mod 2GB
slburke67,

Welsome to Bytes!

You don't provide much information for us to go on. Do you want the e-mail to be sent immediately after the check box is checked? That is somewhat of a strange methodology, but I understand how it can work that way.

The basics of ryour code would be similar to this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub chkCheckBoxName_AfterUpdate()
  2.     If Me.chkCheckBoxName = True Then
  3.         'Update your Date Fields
  4.         Forms!FormName1.txtDateField1 = Now()
  5.         Forms!FormName2.txtDateField2 = Now()
  6.         'Send the E-Mail - many methods to do this...
  7.         DoCmd.SendObject [blah blah blah]
  8.     Else
  9.         'Update your Date Fields
  10.         Forms!FormName1.txtDateField1 = Null
  11.         Forms!FormName2.txtDateField2 = Null
  12.     End If
  13. End Sub
Those are the basics, but without more information, I am flying blind.

Hope this hepps!
Jun 17 '14 #2
The email is to notify our customer that their order is being cancelled. I would like it to use outlook so that I have a record of the actual email sent in my outbox. Since we deal with the government, records are very important. The reason the checkbox is on 2 forms is there are a couple of times that an order would be cancelled. first when the order is placed - we evaluate and determine shipability and there we cancel or charge the order - second after the order is charged there are times that availability of the product changes so we have to cancel and refund the order. The messages from the 2 forms will be slightly different one saying simply your order is unable to be fulfilled and the other saying availability has changed and the charge to your card was refunded or voided based on the order date and the date the order was cancelled.

I apologize for the vagueness on the process.
Jun 17 '14 #3
twinnyfo
3,653 Expert Mod 2GB
Was my guidance in Post #2 helpful to get you pointed in the right direction? Do you need additional assistance with this issue? We can continue to work through additional details if you have questions.
Jun 17 '14 #4
It did work! Now Im just trying to get down to the details. Getting the email address which in in the orders table but not on the form as well as the sales channel (where the order came from).

So I want the subject to be "Cancellation of your SalesChannel Order PONumber"

After that I think I can get the rest.

You are a fantastic help!
Jun 17 '14 #5
twinnyfo
3,653 Expert Mod 2GB
The SendObject Method creates an e-mail with several parameters. You do not have to send an object. It is very simple to use, although I have begun to use other methods for sending, but this should suffice for now.

You should create several variables: strSubject, strEmailBody (and if you have a list of e-mail addresses, you can create variables for that to). Simply determine what your e-mail should say, and the Subject and who it needs to go and use SendObject like this:

Expand|Select|Wrap|Line Numbers
  1.     DoCmd.SendObject acSendNoObject, , , _
  2.         "person@email.com", , , strSubject, strEMailBody, True
The "True" flag indicates that you can edit the message after it is created, but before it is sent. Setting that value to False will simply send the message.

Again, there are other ways to send e-mail and there are some limitations to the SendObject method.

Hoep this hepps!
Jun 17 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: aish | last post by:
I want to send email using sql stored procedure.my code is work fine in my local sqlserver account. when I use my online sql server it display this error. EXECUTE permission denied on object...
8
by: Nick Li | last post by:
Hi, I am trying to writing a c program to send email using system() function call on Unix(Sun Solaris). I tried the following: #include <stdio.h> #include <stdio.h> int main(void) {
11
by: Mohammed Abdel-Razzak | last post by:
dear sirs i want to send email using c# but i don`t want to use CDONTS or tell me how can i use it i don`t know any thing about CDONTS thanks
4
by: roni | last post by:
i dont like to use ocx controlx. is there new dll for vb.net that do the job ? or newer code, to send email throught outlook express.
2
by: Senthilkumar | last post by:
Hi, I would like to send mail using Outlook or Outlook Express my .net program which is written using vb.net . When ever a new record of particular type is added, i would like to send an...
0
by: Tidan | last post by:
Hi, I would like to send mail using Outlook Express my .net program which is written using vb.net 2.0. When ever a new record of particular type is added, i would like to send an automatic mail...
0
by: padmanabhanp | last post by:
Hai, How to send email using jsp
0
by: thinkwebs | last post by:
hi guys Just i am trying to send email using syste.web.mail in ASP.Net just i have send mail successfully in the web but i can't send mail with attachment in the web. But my coding works properly...
0
by: Bibin | last post by:
I want to send email via Outlook Express and not by Outlook in VB.NET (windows application). I also want to attach files with the email. The mail (in Outlook Express) needs to be displayed before...
10
by: Corwin Moyne | last post by:
Hi there. I'm a complete noob when it comes to VBA. I have some code that I got online to send an email using Outlook through Access 2010. The code works by displaying an Outlook message window, but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.