Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email notification!

Status
Not open for further replies.

bowldog

Programmer
Aug 1, 2001
24
US
I have a database that I would like to incorporate the ability to automatically send me the current record via email once a particular field has been changed. For example, I have a field named DateFinished. I would like to have it automatically email me the record when a date has been entered in that particular field.

Any ideas?
 
use the On the onchange of your field to
and create a macro or event procedure using the sendobject command to email your report !

HTH
 
Hi,
I've only got one thing to add to andrep's suggestion. I would suggest using the "AfterUpdate" event since the "OnChange" is triggered with every keystroke, so you'd get quite a few e-mails per record. Build a query to pull the current record that's on the form. Then you just set it to "Event Procedure" and put fill in the code (replacing of course with your names etc)

The Query woulod look like this:
SELECT YOURTABLENAME.*
FROM YOURTABLENAMEWHERE
WHERE(((YOURTABLENAME.YOURPRIMARYKEY)=[Forms]![YOURFORM]![PRIMARYKEYFIELD]));


Save this as "qryEmail" and this is the code for the "AfterUpdate":

DoCmd.SendObject acSendQuery, "qryEmail", , "YOURE-MAILADDRESSHERE", , , "Record " & Me!YOURPRIMARYKEYFIELD & " has been updated by " & Environ("UserName")

I threw a few extras in there...

This will send you an e-mail with the query results (the record that was updated on that field) and the title will read: Record (Record Number) has been updated by (Network Username of the person who updated the record)

Hope this helps
Kyle ::)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top