Access send email on new enrty to form or database.

csababenyi

New Member
Joined
Nov 17, 2020
Messages
15
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
  2. Web
Hi All. I would like to have Access send out a notification email on new entry to data entry form or table and when a dropdown in form changes value. The new entry notification would be more important to solve.
Not sure where to start, search through forums, video tutorials, looked at conditional formatting.
There is a form with multiple selection dropdowns that does the data entry to the table with a Save Record button.
There is a Search form that shows the table content and have the ability to change multiple options in a record.
Any direction or insight would be greatly appriciated, thank you.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
To initiate any action after a control value or a form record is changed, you can use the AfterUpdate event. You could also use your button click event for form level changes to records. However, it is possible that your button click event is redundant, depending on the style of form. Whenever you move off of a changed record in a bound form that record is saved. This can happen simply by setting the focus to the button (i.e. you don't even have to click it). For controls, data in a control is committed when it loses the focus, but the record itself isn't changed until you move off of it or otherwise force a save. Often people think that something like using the DoCmd.Save on a form saves the record. It does not - that is for saving design view changes via code and it will have no effect on a record.
 
Upvote 0
Solution
To initiate any action after a control value or a form record is changed, you can use the AfterUpdate event. You could also use your button click event for form level changes to records. However, it is possible that your button click event is redundant, depending on the style of form. Whenever you move off of a changed record in a bound form that record is saved. This can happen simply by setting the focus to the button (i.e. you don't even have to click it). For controls, data in a control is committed when it loses the focus, but the record itself isn't changed until you move off of it or otherwise force a save. Often people think that something like using the DoCmd.Save on a form saves the record. It does not - that is for saving design view changes via code and it will have no effect on a record.
Well thank you for your brilliant explanation of the mechanics of Access, had to read it several times to absorb. A bit over my head so I did a workaround, and will play with Focus and Sub SendMessage.

Created a Query with a couple of rows from the Table and set the date criteria to current date -1 day. Added EMailDatabaseObject to the Save Record button on the data entry form.
It works as expected, but cant get rid of that annoying Outlook Security Warning pops up in Access. Tried to change all the security setting in Outlook and Access did not help.
Its ok for now, guess one way to butcher Access to do what i need, until I come up with a better solution.
Thanks again.
 
Upvote 0
There are lots of threads out there about that warning. Maybe you can find one that will help you.

One way around this is to use CDO (Collaborative Data Objects, a library reference in Access) and code to send email. That bypasses Outlook altogether and uses the email server. That is somewhat complicated but at least it's an option IF there is a server and you can use it directly. If that server is HotMail or similar, then that definitely adds a wrinkle - maybe even a barrier. To find the server settings, look at the headers of an email that you send to yourself.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top