1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

How to pull data from an Acess 2010 database using Word 2010 VBA

Discussion in 'Business Applications' started by CHOMER, Dec 21, 2011.

Thread Status:
Not open for further replies.
  1. CHOMER

    CHOMER Thread Starter

    Joined:
    Jul 22, 2011
    Messages:
    9
    Win 7 SP1 64-bit
    Word 2010
    Access 2010

    We have some fill-in form templates that we have moved from Word 2003 to Word 2010 (properly) and in the underlying form macro, there is a call to a database to pull office address information that originally was in Access 2003. The macro works just fine if it opens the 2003 version, but I want to update the database to 2010 so that I don't have to worry about compatibility issues. So, after creating a new 2010 database, I went into the Word macro and changed the name of the database in the macro to reflect the new 2010 database, and nada. The statement that accesses the database does not seem to work. Here is the text:

    Dim conn As New ADODB.Connection
    conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    conn.Open Environ("ALLUSERSPROFILE") & "\Application Data\sgData01.accdb"

    Dim rs As New ADODB.Recordset
    rs.Open "select * from offices where shortName = '" & sCity & "';", conn

    I am NOT a programmer so if there is further information you need, please let me know. I assume, though, that perhaps 2010 uses something other than Microsoft.Jet.OLEDB.4.0 or something like that...

    Any and all assistance will be HUGELY appreciated!!

    C. Homer
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1032322

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice