none
Returning corresponding data from Access using Word vba RRS feed

  • Question

  • I want to be able to pull corresponding data from an Access d/b from the id's stored in a customxmlpart.  For example, an OfficeID from the customxmlpart.  I want to find the office name from an Access d/b.  Same with author.  I have the authorid stored in the customxmlpart, and I want to pull author login field from the database.  I want to assign this corresponding data to Word variables. 

    I have never queried Access from Word using vba.  Help would be greatly appreciated.

    Monday, January 30, 2012 4:36 PM

Answers

  • Hi Orland

    You first need to specify the version of Access and the version of the database file (*.mdb or *.accdb) with which you'll be interacting.

    Then you need to define the SQL Statement for querying the information. A good way to start is to create a query in the Access database that gives you the desired result, then go to the SQL view of the query and copy/paste that.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by orlandp Tuesday, January 31, 2012 11:04 PM
    Tuesday, January 31, 2012 12:45 PM
    Moderator

All replies

  • Hi Orland

    You first need to specify the version of Access and the version of the database file (*.mdb or *.accdb) with which you'll be interacting.

    Then you need to define the SQL Statement for querying the information. A good way to start is to create a query in the Access database that gives you the desired result, then go to the SQL view of the query and copy/paste that.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by orlandp Tuesday, January 31, 2012 11:04 PM
    Tuesday, January 31, 2012 12:45 PM
    Moderator
  • Thanks.  Found some great help at www.connectionstrings.com too.
    Tuesday, January 31, 2012 11:04 PM