HELP:::trigger email to email addresses in table (1 Viewer)

grooving

New member
Local time
Yesterday, 20:48
Joined
Jul 27, 2006
Messages
4
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.!!!!!!!!!!!!!!!:confused: :mad: ..

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:

ImLost

Registered User.
Local time
Yesterday, 20:48
Joined
Nov 16, 2005
Messages
44
I am looking for something similar to this, too. I have a field for email address and want Access to pull the address to send an email at the click of a button without having to type the addresses in. Is this possible? I don't know VBA or any code, so I'd have to be able to do with queries and macros. I have successfully used the sendobject command in a macro with manually entered email addresses, but this is new to me.


edit - ok, looked through more of the email threads here and think I see that it's more trouble than it's worth. ^_-
 
Last edited:

Teebird

Registered User.
Local time
Today, 13:18
Joined
Sep 3, 2006
Messages
60
Here is some code that I use behind these 2 fields of my form linked to a query on a table that contains the field EmailName.

txtbox on form - txtEmailName
Control Source: EmailName

command button on form - cmdEmail
On click event

On click of cmdEmail, it will open Lotus Notes - have not tried with Outlook.

Cheers Tee
 

Attachments

  • Email Code.txt
    742 bytes · Views: 148

keiths

Registered User.
Local time
Yesterday, 21:48
Joined
Feb 10, 2005
Messages
28
Solution is in the sample databases

Here is a link to the sample databases thread that should help you with your problems. The code/queries are included in the sample database.
I think everything you are looking for is included.

http://www.access-programmers.co.uk/forums/showthread.php?t=111046

The sample database is intended to allow you to send emails without the need for ms outlook or other email programs. However, the code/queries are common enough that you can utilize them with whatever you need.

There are a number of threads in this forum regarding email. Doing a forum search for "email" will give you loads of examples you can try out. There is a number of ways you can do what you want....it is up to you to decide which best suits your situation.
 

Users who are viewing this thread

Top Bottom