How to Link Outlook items to Access OLE field

R

Rick Schneider

I want to drag and drop Outlook items to an OLE field in Access (and thus be
able to open them from Access). The only way I have found to do this is to
drag eg and email to the Outlook journal folder holding down the right mouse
button, and selecting "Copy here with shortcut." I can then drag the shortcut
on the journal form to an OLE field in Access. Clicking on the OLE field
opens the email. Works for other items as well (Contacts etc.). Since this
works it would seem that the technology is there in some way to drag and drop
directly, and OLE seems to be the key. But I am a complete novice when it
comes to OLE.

Any help is greatly appreciated.

Rick
 
D

David H

What are you trying to accomplish?

There is an ActiveX control that's included with Outlook that allows you to
actually view and work with folders and items from within Access as if you've
actually got Outlook open.
 
R

Rick Schneider

David,

Thanks for the reply.

The DB that I have developed is centered around project management.
Projects, tasks within them, etc. Integrated with it as a knowledge base
that links in documents that were used to complete the project - files,
articles, conversations, whatever, including emails. So to complete the
knowledge base I would like to link specific emails in. I know that you can
link Outlook folders, but that doesn't do it because there is no index
within them to refer to, and thus no way to directly link the item in.

Thanks for any help you can provide.

Rick
 
D

David H

As far as storing the MailItem in the DB, that's beyond my realm of
knowledge. I've never even used the OLE field type. So can't help you there.

Are you storing all of the various objects within Access or are you saving
them on a file server with the paths in the DB?
 
R

Rick Schneider

Gina,

Thanks, you are right. See my latest post to David in this thread. I think
I will handle it the way I explained it there. A few more steps but that's
the breaks.

Thanks for the response.

Rick
 
R

Rick Schneider

I am storing them external to the DB, just including the paths in hyperlink
fields. That keeps the size down.

As Gina says in this thread, including the OLE object does increase the
size, so perhaps it's best just to copy the email I want to document to a
directory and link it as I do with Excel or other files. That works well,
because when you drag a file to a hyperlink field, it automatically creates
the path/link.

Thanks for your interest and help.

Rick
 
D

David H

Sounds like you have two steps
1) Save the MailItem as an external file (.msg)
2) Grab the path to the .msg file and save it in the Access Database.

The Outlook View Control ActiveX control provides users with the ability to
view the contents of Outlook folders from applications like Access. You could
create code that looks at the selection in the Explorer, saves the file and
then captures the file path in the database.

The user will open the Access form with the OVC, click on the MailItem to
selecte it and then *click on a button on your Access form* to save it.

You'll have to create you're own SAVE function in order to capture the path
as you won't be able to do so using the one in Outlook.

The Explorer object in the Outlook Object Model exposes a .Selected property
which can be used to grab the items selected by the user. I've never worked
with the Outlook View Control within Access so I don't know how you reference
the property from within Access, but it should be entirely doable.

I would start by developing code in Outlook that takes the SelectedItem in
an Explorer and saves it to disk returning the path of the location. You can
certainly build this within Outlook to shake down the bugs before you add it
to Access.

When you do start building in Outlook, you'll be building a Sub that handles
saving the item as opposed to using the Save/Save As functionality in Outlook
on the menu.

The logic will essentially be...

-Open the Windows Open/Save Common Dialog to get the location where the
files should be saved
-Loop through the selected items in the explorer
-Save the file using the .SaveAs method
-Update the underlying table in access or create a new record

The link below will show you how to use the Windows Open/Save Dialog to
enable the user to navigate the file system and return the selected path. You
shouldn't have any problems dropping the code into Outlook.

The next article will show how to work with the items Selected in an
explorer. Saving the item as a .msg file is just a matter of calling the
..SaveAs method of the item once you have a reference to it.

http://www.microsoft.com/office/com...soft.public.outlook.program_vba&lang=en&cr=US

(Scroll down to the 'Selection method' topic 4/5ths of the way down)
http://support.microsoft.com/default.aspx/kb/313800

The article is aimed at VB.NET however it does cover the basic objects and
methods that you'll need to get at the selected items. It can't be used
as-is, but you should be able to easily adapt it.

Finally, the Outlook newsgroup is the best place for help with all things
related to Outlook.

http://www.microsoft.com/office/com...soft.public.outlook.program_vba&lang=en&cr=US

http://www.microsoft.com/office/com...soft.public.outlook.program_vba&lang=en&cr=US
 
R

Rick Schneider

Thanks, David. I will look through this and see if i can figure it out.

All the best,
Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top