Results 1 to 8 of 8
  1. #1
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Calgary, Alberta, Canada
    Posts
    818
    Thanks
    6
    Thanked 1 Time in 1 Post

    Activate Outlook from within Access?

    I am looking at designing an application to track project issues. The Application would be built in Access. What I am wondering is whether or not there is a way to put some of the "Issue" information into an Outlook mail message and post it to the Project Manager, every time an new issue is entered. Is there some way of activating a VBA script that would do this? Any insight, help is appreciated. Thanks.

    Ron M

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Activate Outlook from within Access?

    The simple answer is "Yes", but what are you actually trying to accomplish besides drive the Project Manager crazy with e-mails? How often would you expect this to take place? If it happens frequently, you might be better advised to log it into a file and let the Project Manager check the log at intervals.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Calgary, Alberta, Canada
    Posts
    818
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Activate Outlook from within Access?

    The object is not to drive the PM crazy, but to nag him a bit. Since these are relatively small projects, I don't anticipate more than one or two "issues" a day on a bad day -- on larger projects, you are right, you would drive him crazy with e-mails and I agree, it would be better to log to a file and have him check the log at intervals. I was interested in whether it could be done and how one might do it.

    Ron M

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Activate Outlook from within Access?

    I've done it to external addresses using Outlook and Exchange Server, but there's another alternative as well.

    Reference Point Software has a product called SendMail which allows you to use Access to send a message across a network through an SMTP server. You can also contact them at info@ReferencePointSoftware.com.

    This method is faster than using Outlook since it doesn't have to load the email program at all, and it was designed for exactly what you're trying to do.

    If SendMail doesn't suit you, post again and I'll find the code I used. or maybe someone else has some they'll post in the meanwhile.
    Charlotte

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Activate Outlook from within Access?

    Hi

    I developed a class module to send mails. Comments are in dutch, but the coding speaks for itself:

    Option Compare Database
    Option Explicit
    '************************************************* ******
    'Class clsMAPI
    '************************************************* ******
    'Algemene declaraties voor een email object.
    '************************************************* ******
    Dim objMySes As Object 'Session object voor de MAPI sessie


    Public Function SendMail(txtMailTo As String, Optional txtText As String, Optional txtSubject As String) As String
    '************************************************* ******
    'Functie voor het versturen van een mailtje.
    'De returnwaarde is een string.
    'Als de string leeg is is de toevoeging succesvol geweest.
    'Als de string niet leeg is, dan bevat de string een
    'foutboodschap.
    '
    'LAATSTE WIJZIGING:
    ' Versie 1.0 augustus 2000 B. Stam
    ' Initiele versie van de functie
    '************************************************* ******
    If gTrace Then
    Debug.Print "clsMAPI SendMail"
    Else
    On Error GoTo ErrorHandler
    End If

    Dim strMessage As String
    Dim objRecip As Object
    Dim objMes As Object

    '************************************************* ******
    'Ontvanger is verplicht.
    '************************************************* ******
    If txtMailTo = "" Then
    strMessage = "The recipient of the mail is not valid or not given!"
    GoTo ExitFunction
    End If

    '************************************************* ******
    'Niet ingevulde parameters afhandelen.
    '************************************************* ******
    If IsMissing(txtText) Then
    txtText = ""
    End If
    If IsMissing(txtSubject) Then
    txtSubject = ""
    End If

    '************************************************* ******
    'De boodschap zelf invullen.
    '************************************************* ******
    Set objMes = objMySes.Inbox.Messages.Add
    With objMes
    .Text = txtText
    .Subject = txtSubject
    End With

    '************************************************* ******
    'De ontvanger invullen
    '************************************************* ******
    Set objRecip = objMes.Recipients.Add
    With objRecip
    .Name = txtMailTo
    .Resolve
    '.Send
    End With

    '************************************************* ******
    'En nog even versturen.
    '************************************************* ******
    objMes.Update
    objMes.Send ShowDialog:=False

    ExitFunction:
    If strMessage <> "" Then
    SendMail = strMessage
    Else
    SendMail = ""
    End If
    Exit Function

    ErrorHandler:
    SendMail = Chr(10) & Chr(13) & "Errornumber: " & CStr(Err.Number) & " "
    SendMail = SendMail & "Errormessage: " & Err.Description
    Exit Function
    End Function

    Private Sub Class_Initialize()
    '************************************************* ******
    'Bij het instantieren van het object een MAPI sessie
    'openen.
    'Let op de profilename is afhankelijk van het mail
    'programma dat gebruikt wordt.
    'Als profilename weggelaten wordt, dan wordt er, indien
    'noodzakelijk, automatisch om gevraagd.
    '************************************************* ******
    If gTrace Then Debug.Print "clsMAPI Class_Initialize"
    Set objMySes = CreateObject("MAPI.Session")
    If Not objMySes Is Nothing Then
    objMySes.Logon 'Als profilename niet gegeven hoeft te worden.
    'objMySes.Logon profileName:="Microsoft Exchange"
    End If

    End Sub

    Private Sub Class_Terminate()
    '************************************************* ******
    'Als het object verwijderd wordt ook de MAPI sessie
    'verwijderd.
    '************************************************* ******
    If gTrace Then Debug.Print "clsMAPI Class_Terminate"
    objMySes.Logoff
    End Sub


    Bart
    Software designer

  6. #6
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Calgary, Alberta, Canada
    Posts
    818
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Activate Outlook from within Access?

    Thanks to you both. I appreciate your help with this. Charlotte, I will do some further investigation on the Send Mail product, in the meantime, if you wouldn't mind posting the code you mentioned. Again many thanks for the help and insight of you both.
    [img]/w3timages/icons/smile.gif[/img][img]/w3timages/icons/smile.gif[/img]

    Ron M

  7. #7
    Lounger
    Join Date
    Jan 2001
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Activate Outlook from within Access?

    Ron - No one seemed ask what, if anything you are using to manage your projects. If you are using MS Project, as more and more people are, you may want to take advantage of the built-in workgroup features, or Project Central.

    Definately worth looking at to save you from reinventing the wheel.

    Just a thought.

    Rich P.

  8. #8
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Calgary, Alberta, Canada
    Posts
    818
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Activate Outlook from within Access?

    Thanks Rich. I will look into it.

    Ron M

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •