Generating an Email Notification

clipperscoach

New member
Local time
Yesterday, 18:58
Joined
Mar 1, 2012
Messages
1
I'm in need of some help...

I have created two tables for our company.

- One (Staff Table) that list all staff information. Fields are (Last Name, First Name, Department, Office Phone, Email)

-One (Staff Delivery Table) that contains information for incoming purchase order deliveries. Fields are tracking number, vendor, Card Holder (Look Column the references Staff),

I've created a form that will allow me to update information to the purchase order table as the purchase order arrives at the warehouse.

On the bottom of the form I want to create a command button (Send e-mail Notification) so that I can click on it and have it generate a notification e-mail to the staff member who placed the order letting them know that the order has in fact arrived at our warehouse but I can't seem to get it coded correctly.

Any suggestions??
 
I have been looking for something similar. I have found a couple things but they are meant for emailing reports thru access.. the website below has something that might help, being Monday morning I have not had the time to test it out.

In the example on the website below, it seems he is comparing names to a Outlook address book. In your case you will just need to pull the email from the table correct? If you have the time today to test this out let me know the results please.


Because of my post count... I cannot paste a link, just google search this

how to send emails from access

it should be the top result on jephens website.
 
Howzit

THis is what I use to send an email with Outlook. You will need the Microsoft Outlook 11.0 Object Library selected in your references.

You will need to modify it to pick up the correct email address for the order andthe email content etc.

Code:
Option Compare Database
Option Explicit

Private Sub cmdEmail_Click()


' Original code copied from http://www.ozgrid.com/forum/showthread.php?t=51384
'Stop
Dim OutApp As Object
Dim OutMail As Object
Dim varPress As Variant

Dim sTo As String
Dim sCC As String
Dim sBCC As String
Dim sSub As String
Dim sBody As String
Dim strCC As String

strMess = "You are about to send an email notification to the user." & vbCrLf & vbCrLf
strMess = strMess & "Do you wish to continue?"

strStyle = vbYesNo
strTitle = "Send Notificaiton"

' Ask if the user wants to send an email
varPress = MsgBox(strMess, strStyle, strTitle)
If varPress = vbYes Then
    ' Who to send it to
    sTo = Me.EmailAddress
    
    ' What s the subject
    sSub = "Some subject matter"

    ' Write the body of the email
    sBody = Me.FirstName & vbCrLf & vbCrLf
    sBody = sBody & "More email burb coming through"

    ' Send the email    
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    sCC = ""
    sBCC = ""
  

    With OutMail
        .To = sTo
        .CC = sCC
        .BCC = sBCC
        .Subject = sSub
        .Body = sBody
        .Send
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
End If


End Sub
 

Users who are viewing this thread

Back
Top Bottom