By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,514 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

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

P: 5
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!

Share this Question
Share on Google+
5 Replies


twinnyfo
Expert Mod 2.5K+
P: 3,482
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

P: 5
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
Expert Mod 2.5K+
P: 3,482
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

P: 5
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
Expert Mod 2.5K+
P: 3,482
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

Post your reply

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