Search code examples
vbams-accessoutlooktransfer

Efficient transfer of data from Outlook to Access?


The StackOverflow question, Link Outlook to Access, has a detailed answer that loops through the mail items in an Outlook folder and inserts selected properties into an Access table. Another question about the difference between looping through an Outlook table and an Outlook folder has two answers that say that Outlook tables are similar to SQL tables and that an Outlook table is retrieved in a single call instead of by opening items and retrieving properties one at a time. This makes me wonder if there's a more efficient way to output properties of a set of e-mails from Outlook to Access, instead of by looping through the items and properties, to:

  • Make a table in Outlook and then transfer the whole table to Access, or
  • Run a query on Outlook objects that makes the table directly in Access.

Is there a way to do something like that?


Solution

  • No, Table object is like client-side Recordset - you still have to loop through the rows and access columns, but all the data has already been retrieved from Outlook.

    The only difference is that Recordset object is loaded in-proc and Table (Outlook being an out-of-proc COM server) is in the outlook.exe address space, so each call results in an RPC call.