Pass Varibale from Access to Outlook

Hi, I'm opening an Access Database from Outlook (CreateObject("Access.Application").
When the Access app opens, it runs some VBA code.  In the VBA code are some variables that get set.  I would like to pass these back to Outlook.

So something like.
dim LocalVariable as String
LocalVariable = AccApp.AccessVariable

?
LVL 1
NO_CARRIERAsked:
Who is Participating?
 
ducky801Connect With a Mentor Commented:

Have you considered having your access code write your varible value to a table which can then be read by your outlook code?  

Alternatively, you could create an access object in your outlook routine and reproduce your access code there (run the access stuff from outlook).  
In order to do this you'll have to add a reference.. In outlook VBA editor : Tools>References | Microsoft Accss XX.0 Object Library
Then your code would look something like this:

Sub DoStuffInAccessFromOL()
Dim objAccess As New Access.Application
objAccess.OpenAccessProject "C:\mydb.mdb", False

'use the objaccess object to manipulate access here
 

End Sub

 
 If you'd like to post your existing outlook code, i can take a look for you.
 
Hope this helps
 
AR
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.