[AccessD] Can I open outlook messages from Access?

Jim Lawrence accessd at shaw.ca
Mon May 11 00:40:20 CDT 2009


Hi Darren:

Your approach is a lot more specific than mine and would work just fine in
this situation.

Jim

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren D
Sent: Sunday, May 10, 2009 9:49 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Can I open outlook messages from Access?

Hi Lonnie

Outlook Calendar items (appointments) have a PK type of thing called the
EntryID

If you know that you can open the relevant outlook item

EG - This is what I use to open Calendar items (Appointments)

You should be able to use this to open all sorts of outlook items if you
know
the relevant EntryID

Hope this helps

~~~~~~~~~~~
Function f_FindOutlookAppointment(xstrEntryID As String)
   
  On Error GoTo Err_
   
   Dim ol As Outlook.Application
   Dim olns As NameSpace
   Dim objFolder As Object
   Dim StoreID As String
   Dim AllAppts As Outlook.Items
   Dim Item As Object
   Dim strFind As String
   
   
   Set ol = New Outlook.Application
   Set olns = ol.GetNamespace("MAPI")
   Set objFolder = olns.GetDefaultFolder(olFolderCalendar)
   StoreID = objFolder.StoreID
   Set AllAppts = objFolder.Items
   strEntryID = xstrEntryID
   Set Item = olns.GetItemFromID(strEntryID, StoreID)
   
   Item.Display
   
   Set ol = Nothing
   Set olns = Nothing
   Set objFolder = Nothing
   Set AllAppts = Nothing

Exit_:
Exit Function

Err_:
If Err.Number = -1871445753 Then
    MsgBox "Please ensure Outlook is open", vbInformation, "Cannot retrieve
Outlook Item"
ElseIf -1629224689 Then 'Can't find item - probably deleted
    MsgBox "Sorry - I can't find that Outlook item." & vbCrLf & vbCrLf _
        & "It appears to have been deleted from the Outlook Calendar",
vbQuestion + vbYesNo, "Error Retrieving Outlook Calendar Item
    
Else
    MsgBox Err.Number & " " & Err.Description, vbCritical, "Error Retrieving
Outlook Calendar Item"
End If
Resume Exit_
   
End Function
~~~~~~~~~~~~~~~~~~~~~~~~~~


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Lonnie Johnson
Sent: Monday, 11 May 2009 11:49 AM
To: AccessD solving'
Subject: [AccessD] Can I open outlook messages from Access?

I am creating an app for a friend. He wants to see his task, emails and
appointments in an Access form. I was able to do that.

What he wants to do now is double click on one of the emails in a continuous
form I build and the email actually opens. Does anyone have code for that? 
 
May God bless you beyond your imagination!
Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Visit me at ==> http://www.prodev.us


      
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list