Link to home
Start Free TrialLog in
Avatar of Anton Fernando
Anton Fernando

asked on

I need to write to a table in access from outlook to use as a log when an email is received and attachment spreadsheet saved (or not saved).

Reading the various web pages on the internet it seems that you can use VBA in all the main office applications providing you have the correct DDL /references connected. With this in mind, I wanted to make outlook when it received a particular email would save the attached spreadsheet and then get MSaccess to load the tables in it. This all now works. 

User generated image The connection I made between Outlook and access was based around  


Dim Db as access.application 

set Db = getobject( Database filepath&name.accdb)

Db.run "AccessMacro"


This works so I thought I would try to access a record set so using a dao connection I did the following :


Dim db As DAO.Database
Dim rstRset As DAO.Recordset

Set db = OpenDatabase("D:\Access\TestDAOLinkWithOutLook.accdb")

This code works with access to access connection, but failed with outlook to access.


User generated image 

 I get this error.  


What am I missing ?? Is it a referrence DDL ? This is a vital point I need to get past before I can get my hands on the recordset and start adding/changing  it.


Thanks in anticipation !



Avatar of als315
als315
Flag of Russian Federation image

You had to open Access to use macros:
Dim acObj As Object
Set acObj = CreateObject("Access.Application")
acObj.Application.Visible = True
acObj.OpenCurrentDatabase "D:\Access\TestDAOLinkWithOutLook.accdb"
acObj.Application.Run "YourMacroName"
acObj.Quit

Open in new window

Avatar of Anton Fernando
Anton Fernando

ASKER

Thank you for your response. Yes. I know. As I said I have said before this method works as I have to 2 macros running successfully.

What I am trying to do is more direct. It is to get an build a limited dataset in memory (VBA in outlook) from access using the DAO method as it seems its the only way I can define a dataset object. Looking at other people who have had the same issue it seems to be down to a DLL library. I think I need access to the Microsoft Office 16.0 Access Database Engine Object Library  but when i try to get access I get the following error message:

User generated imageI have made no other module or project.  
 
ASKER CERTIFIED SOLUTION
Avatar of Anton Fernando
Anton Fernando

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial