Pass Varibale from Access to Outlook

Posted on 2009-04-24
Last Modified: 2013-11-27
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

Question by:NO_CARRIER
    1 Comment
    LVL 5

    Accepted Solution


    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
    Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
    Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now