Hi all,
I have built a database that logs faults for customers. I want my database to automatically send an email when a new fault is logged to the database. This email will be sent to email adresses stored in a contact table.
I tried to use a macro, but it limits me to type in an email address. I do not know where to start with this. Im stuck...need some help.!!!!!!!!!!!!!!! ..
Code:
'------------------------------------------------------------
' Test2
'
'------------------------------------------------------------
Function Test2()
Dim MyMail As Outlook.MailItem
On Error GoTo Test2_Err
DoCmd.SendObject acQuery, "TOT_CUSTOMER", "HTML(*.html)", "myemailadress@me.com", "", "", "Test", "Total Failure", False, ""
'Trap to handle No Send virus check
On Error GoTo NoSend
'Cleanup
CleanUp:
Set MyMail = Nothing
Test2_Exit:
Exit Function
Test2_Err:
MsgBox Error$
Resume Test2_Exit
'Trap to handle No Send dialogue
NoSend:
'
If Err.Number = 286 Then
MsgBox "Send to Outbox Stopped", vbCritical, "Send Stopped"
GoTo CleanUp
'
Else
MsgBox "Send or Programme Error - seek Help", vbCritical, "Send Stopped"
GoTo CleanUp
End If
I have built a database that logs faults for customers. I want my database to automatically send an email when a new fault is logged to the database. This email will be sent to email adresses stored in a contact table.
I tried to use a macro, but it limits me to type in an email address. I do not know where to start with this. Im stuck...need some help.!!!!!!!!!!!!!!! ..
Code:
'------------------------------------------------------------
' Test2
'
'------------------------------------------------------------
Function Test2()
Dim MyMail As Outlook.MailItem
On Error GoTo Test2_Err
DoCmd.SendObject acQuery, "TOT_CUSTOMER", "HTML(*.html)", "myemailadress@me.com", "", "", "Test", "Total Failure", False, ""
'Trap to handle No Send virus check
On Error GoTo NoSend
'Cleanup
CleanUp:
Set MyMail = Nothing
Test2_Exit:
Exit Function
Test2_Err:
MsgBox Error$
Resume Test2_Exit
'Trap to handle No Send dialogue
NoSend:
'
If Err.Number = 286 Then
MsgBox "Send to Outbox Stopped", vbCritical, "Send Stopped"
GoTo CleanUp
'
Else
MsgBox "Send or Programme Error - seek Help", vbCritical, "Send Stopped"
GoTo CleanUp
End If
Last edited: