Can you email out of a form?

Allisean05

Registered User.
Local time
Today, 15:04
Joined
Jul 29, 2008
Messages
10
Is there a way that once a field has changed in Access that it sends an email out to a list of people saying an change has been made or a record has been added.

I do not think this is possible, but if someone could answer, that would be great!
 
Yes you should be able to, in the on change event of the field you wish to monitor place the following code;

Code:
    Dim stDocName As String
    Dim stMsgText As String
    Dim stSubText As String
    Dim stAddText As String
    
    stMsgText = "Data has been Change, Please refer to attached Report" [COLOR="SeaGreen"]'insert your own message between the quotes for the body of the email[/COLOR]
    stSubText = "Cahnge of Data" [COLOR="SeaGreen"]'Insert your own subject line between quotes[/COLOR]
    stAddText = "Name@hotmail.com" [COLOR="SeaGreen"]'insert your own recipient email address/es between quotes[/COLOR]
    stDocName = "Report1" [COLOR="SeaGreen"]'report containing details of change[/COLOR]
    
    DoCmd.SendObject acReport, stDocName, acFormatSNP , stAddText, , , stSubText, stMsgText
 
Last edited:
Luddite Lad's will send the report to all desired users once you tell it to. If you only want to send a Notification, try this

DoCmd.SendObject acSendNoObject, stDocName, , stAddText, , , stSubText, , True

I think that is right
 
Sorry but my code will only send the report to the nominated emails adress/es, that you place in the following line of code (from the above) Which I have coloured and bolded below for clarity.

Code:
stAddText = [COLOR="Red"][B]"Name@hotmail.com"[/B][/COLOR] [COLOR="SeaGreen"]'insert your own recipient email address/es between quotes[/COLOR]
 
Whoops sorry misread/understood your response my bad :(
 
Whoops sorry misread/understood your response my bad :(

No problem here. I assumed from his description that he would only need to inform the users that the report was available so that they could pick it up, while you assumed that he would deliver it to them when it was done. Either interpretation makes sense based on the original post. Yours is a good idea unless the report is too big to be sent as an object.
 

Users who are viewing this thread

Back
Top Bottom