Programmatically Export Outlook Mail to Microsoft Access

G

Guest

I need to be able to open an email in Outlook 2003 and then click a button on
the toolbar which will move this message to a MS Access 2003 database. I
assume I'll need to right some sort of VBA code in Outlook 2003 which I can
link to my toolbar button, but I really don't know if my logic is correct on
what I need to do and I don't know how to begin.

I've done a lot of research, but I just can't seem to find what I need as
far as writing the VBA code to send the email to Access. I did open my
Access database and linked a table to Outlook. This works fine, but I need
my users to be able to be in Outlook and then send the email over to Access
for further manipulation.

Any assistance would be greatly appreciated.
 
Joined
Jun 5, 2006
Messages
1
Reaction score
0
I do not anderstend what do you want to export to Access e-mail body or Attachment???
If Attachment then http://www.fontstuff.com/outlook/oltut01.htm it helped me much. And after save attachmet use import from Access. I have to do with .XML attachments I have to export them to MS Access automatically. In Access I now use this code
Code:
Private Sub Form_Load()
Dim f As String
Dim zpath As String
           zpath = "\\Medserver\medsi2\IT\zapis.xml"
           Application.ImportXML zpath, acAppendData
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "zapros_ne_obr"
DoCmd.OpenQuery stDocName, , acReadOnly
End Sub
I hope it help you to start.
 
G

Guest

Hello...I am looking for something similar to handle support issues that we
get via email. Were you able to find a solution to the button in the message
tool bar? GaryA
 
G

Guest

No, I ended up creating a linked table in Access to an Outlook folder. Then
I created an Append query to append the data to another table, and a Delete
query to delete the contents of the Outlook folder once it was in the
database.

Currently, I'm having my users move or copy the email they want in the
database into this folder.
 
Joined
Jun 22, 2006
Messages
1
Reaction score
0
I've just successfully done almost exactly this. I created a a string with a SQL INSERT INTO query to add one record to my access table. Here is my code. You run it from inside a mail viewer (I added a toolbar button).
Sub LogItem()
Dim myOlApp As New Outlook.Application
Dim myItem As Object
Set myItem = myOlApp.ActiveInspector.CurrentItem
With myItem

Set AppAccess = GetObject("[Path of Access file].mdb")

strSQL = "INSERT INTO Tbl_Outlook_Log ([Subject], [sent], [Received], [No of Attachments])"
strSQL = strSQL & " VALUES ('" & Replace(.Subject, "'", "''") & _
"', #" & Format(.SentOn, "dd-mmmm-yyyy") & "#, #" & _
Format(.ReceivedTime, "dd-mmmm-yyyy") & "#, " & .Attachments.Count & ");"
AppAccess.DoCmd.SetWarnings False
AppAccess.DoCmd.RunSQL strSQL
AppAccess.DoCmd.SetWarnings True
End With
End Sub

Martin Green has good simple examples of using SQL in Access VBA if like me you are fairly new to SQL. (http://www.fontstuff.com/access/index.htm)
 

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