UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Send Data From Outlook To Access, Office 2013    
 
   
LonesomeDove
post May 21 2017, 12:32 PM
Post#1



Posts: 339
Joined: 14-October 10
From: Southeastern Pennsylvania


Is there a way to send data from Outlook to a split database back end?

The data begins life in a web form which is emailed to my customer’s Outlook email client. An Outlook rule recognizes the email and moves it to a special folder. A periodic routine looks in the folder to see if there are any emails.

If possible, I would like to have Outlook write each email body data directly to the database back end. Is this possible? I assume either DAO or ADO would be used.

The environment is Windows 10 and Office 2016. The database is accdb.

Thanks in advance.

--------------------
LonesomeDove
"There is great satisfaction in building good tools for other people to use." - Freeman Dyson
Go to the top of the page
 
GlenKruger
post May 21 2017, 05:34 PM
Post#2


Utterly Crispy UA Forum Administrator
Posts: 8,766
Joined: 29-September 01
From: Edmonton,Alberta,Canada


Hi not sure about a split back end but if you look under external data and click on more there is an option to import or link to an Outlook folder. It maybe away of doing it, just guessing though as I have never done it.

--------------------
Human nature, it is a funny thing and the hardest thing to program to prevent.
Glen Kruger KNKConsulting
MS Access MVP 2013-2018| Wrox Techincal Contributor
Go to the top of the page
 
Jeff B.
post May 21 2017, 05:38 PM
Post#3


UtterAccess VIP
Posts: 9,880
Joined: 30-April 10
From: Pacific NorthWet


?Why? What will having "Outlook data" in "Access" then allow you to do?

--------------------
Regards

Jeff Boyce
Microsoft Access MVP (2002-2015)

Mention of hardware or software is, in no way, an endorsement thereof. The FTC of the USA made this disclaimer necessary/possible.
Go to the top of the page
 
ADezii
post May 21 2017, 06:23 PM
Post#4



Posts: 1,857
Joined: 4-February 07
From: USA, Florida, Delray Beach


  1. I agree with Jeff B. also, but if you insist on taking this approach, here is how it can be done.
  2. Set References to Microsoft Outlook, Microsoft Access, and DAO Object Libraries.
  3. For this Demo, I created a Database named Test.mdb in the C:\Test Folder. Test.mdb has a Table named tblEmails with the Fields [Subject] and [Body].
  4. The following Code, executed from an Outlook Macro, will write the Subject and Body of every E-Mail in your Inbox to tblEMails in C:\Test\Test.mdb.
  5. The Code to do this is as follows, but again, why this approach?
    CODE
    Public Sub ExportOutlookData()
    Dim oApp As Outlook.Application
    Dim oAccess As Access.Application
    Dim wrkAccess As Workspace
    Dim MyDB As DAO.Database
    Dim oInbox As Outlook.MAPIFolder
    Dim oInboxItems As Outlook.Items
    Dim oMail As Outlook.MailItem
    Dim rst As DAO.Recordset

    Set oApp = New Outlook.Application
    Set oInbox = oApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
    Set oInboxItems = oInbox.Items
    Set oAccess = New Access.Application

    'Create Microsoft Access Workspace and Database Objects
    Set wrkAccess = oAccess.DBEngine.CreateWorkspace("", "admin", "", dbUseJet)
    Set MyDB = wrkAccess.OpenDatabase("C:\Test\Test.mdb", True)

    Set rst = MyDB.OpenRecordset("tblEMails", dbOpenDynaset)

    For Each oMail In oInboxItems
      With rst
        .AddNew
          ![Subject] = oMail.Subject
          ![Body] = oMail.Body
        .Update
      End With
    Next

    oApp.Quit
    oAccess.Quit
    rst.Close
    Set oApp = Nothing
    Set oAccess = Nothing
    Set rst = Nothing
    End Sub
Go to the top of the page
 
LonesomeDove
post May 22 2017, 06:16 PM
Post#5



Posts: 339
Joined: 14-October 10
From: Southeastern Pennsylvania


I am building a database application with certain givens.

My customer's clients will fill out web forms using WuFoo. When the client clicks Submit on the form, WuFoo sends an email (containing the client's data) to my customer which arrives in his Outlook client. An Outlook rule recognizes the WuFoo email and moves it to a special Outlook folder.

The web form data needs to get to an Access database where my customer will review it and manage the work that they have to do as a result of receiving their client's data.

Every few minutes, an Outlook routine wakes up and checks the special folder's contents. If there are any emails in it, the routine opens the database front end on the user's PC, and calls an Access function one of whose input parameters is the email body. The function parses the body and writes the data fields to a table in the back end. After processing all the folder's emails, the routine closes the Access front end and goes back to sleep.

I have all this working in my development environment.

However, it occurs to me that if Outlook tries to call a function in the front end while the user has the front end open and is doing work, there might be some kind of collision causing a crash or other disruption. So I thought that maybe Outlook could write the body directly to the back end and not take a chance on colliding with the user and an open front end.

I'm not insisting on this approach. If there's a better way to get the email body to the database, I'll be happy to consider it.

--------------------
LonesomeDove
"There is great satisfaction in building good tools for other people to use." - Freeman Dyson
Go to the top of the page
 
ADezii
post May 23 2017, 09:14 AM
Post#6



Posts: 1,857
Joined: 4-February 07
From: USA, Florida, Delray Beach


QUOTE
I'm not insisting on this approach. If there's a better way to get the email body to the database, I'll be happy to consider it.

What about periodically checking, via a Form's Timer() Event, the special Outlook Folder via Automation Code from the Access Front End?
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    11th December 2017 - 09:43 PM