Hi guys,
I'm a newbie to Access and VBA so please be patient as I try to explain what I am doing and trying to do.
I have a simple Access application that I am using DAO to connect directly the Outlook Inbox in order to import email information into a table so that I can query it. I am not using the "Linked" method as I want the [EntryID] and other fields that are not available via the Linked method.
I have found some VBA code that I have massaged and it works well but I want to use SQL within my VBA code in order to make things easier and I believe faster.
Here are the DIM's that I have defined:
' Set up DAO objects (uses existing "tblEmail" table)
Dim ol As New Outlook.Application
Dim olns As Outlook.Namespace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.MailItem
Dim objItems As Outlook.Items
Dim rstmessages, rstfiles As DAO.Recordset
Dim MyPath As String
Dim nummessages As Integer
Dim checkName As String
Dim mSQL As String
' Set up Outlook objects.
Set olns = ol.GetNamespace("MAPI")
' Set the Inbox
Set cf = olns.GetDefaultFolder(olFolderInbox)
I want to run a simple Insert query that that will use the Outlook Inbox as the input and insert records if they don't already exist, into the table called "tblEmail"
.RunSQL "INSERT INTO tblEmail (EntryID, Subject) SELECT EntryID, Subject FROM ????????
I have spent ages trying to figure this out but can't figure out how to specify the Inbox as the FROM..
I hope somebody can help me
Cheers
Greg
I'm a newbie to Access and VBA so please be patient as I try to explain what I am doing and trying to do.
I have a simple Access application that I am using DAO to connect directly the Outlook Inbox in order to import email information into a table so that I can query it. I am not using the "Linked" method as I want the [EntryID] and other fields that are not available via the Linked method.
I have found some VBA code that I have massaged and it works well but I want to use SQL within my VBA code in order to make things easier and I believe faster.
Here are the DIM's that I have defined:
' Set up DAO objects (uses existing "tblEmail" table)
Dim ol As New Outlook.Application
Dim olns As Outlook.Namespace
Dim cf As Outlook.MAPIFolder
Dim c As Outlook.MailItem
Dim objItems As Outlook.Items
Dim rstmessages, rstfiles As DAO.Recordset
Dim MyPath As String
Dim nummessages As Integer
Dim checkName As String
Dim mSQL As String
' Set up Outlook objects.
Set olns = ol.GetNamespace("MAPI")
' Set the Inbox
Set cf = olns.GetDefaultFolder(olFolderInbox)
I want to run a simple Insert query that that will use the Outlook Inbox as the input and insert records if they don't already exist, into the table called "tblEmail"
.RunSQL "INSERT INTO tblEmail (EntryID, Subject) SELECT EntryID, Subject FROM ????????
I have spent ages trying to figure this out but can't figure out how to specify the Inbox as the FROM..
I hope somebody can help me
Cheers
Greg