By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,084 Members | 1,956 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,084 IT Pros & Developers. It's quick & easy.

Outlook to Access databae

P: 1

I am working on a projects called as "email mamagement", where we would like to capture all emails coming into a generic mailbox into a database. From here employee would work on the request and update appropriate fields.(Like from it has come, who has sent etc ).

I would like every new email to be updated into a Inbox table.
Everytime I run a new update query, all emails from the mailbox would move into the table. I would like to either move all unique emails into the database or delete duplicates which have entered into the database.

My aim is to reduce as much manual work as possible.

I would love to hear suggestions which would complete my projects.

Thank you so much in advance.
Oct 27 '06 #1
Share this Question
Share on Google+
1 Reply

P: 143
I found this code that may be helpful to you. Havn't used it myself as we now use Lotus Notes. Can't vouch for it, but it might be worth a try.

Sub CommandButton1_Click()
Dim appAccess
Dim nms
Dim strFolder
Dim fld
Dim strAccessPath
Dim rst
Dim dbe
Dim wks
Dim dbs
Dim itms
Dim itm

Set nms = Application.GetNamespace("MAPI")
strFolder = "comtest"

Set fld = nms.Folders("Personal Folders").Folders(strFolder)

'Pick up path to Access database directory from Access SysCmd function

Set appAccess = CreateObject("Access.Application")
strAccessPath = appAccess.SysCmd(9)
'Get DAO version from DBEngine
strDBEngine = appAccess.Application.DBEngine.Version
'MsgBox "DBEngine version: " & strDBEngine
If strDBEngine = "3.51" Then
'Office 97 DAO version
Set dbe = CreateObject("DAO.DBEngine.35")
strDBName = strAccessPath & "fbtestdb.mdb"
ElseIf strDBEngine = "3.6" Then
'Office 2000 DAO version
Set dbe = CreateObject("DAO.DBEngine.36")
strDBName = strAccessPath & "fbtestdb.mdb"
MsgBox "Unknown Office version; canceling"
Exit Sub
End If

'MsgBox "DBName: " & strDBName
Set wks = dbe.Workspaces(0)
Set dbs = wks.OpenDatabase("C:\My Documents\comtest.mdb")

'Open Access table containing contact data
Set rst = dbs.OpenRecordset("Table1")

'Set up reference to Outlook folder of items to export
Set itms = fld.Items
ItemCount = itms.Count
If ItemCount = 0 Then
MsgBox "No Communication requests to export"
Exit Sub
MsgBox ItemCount & " Communication requests to export"
End If

For Each itm In itms
'Custom Outlook properties

rst.subject =itm.Subject

MsgBox "All communication requests exported!"
MsgBox "Quit Access"

End Sub
Oct 27 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.