Solved

Data Connection From Excel 2007 to Access 2007 Query With Selection Criteria

Posted on 2011-09-02
3
199 Views
Last Modified: 2012-05-12
Hi,
I want to build a data connection between from Excel 2007 to Access 2007 to an Access query that has one selection criteria using vba code.

I would appreciate any help!

Thanks
Gary
0
Comment
Question by:tgtg7
  • 2
3 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 36475252
you can use codes like this

dim db as dao.database, sql as string, rs as dao.recordset, dbPath as string
dbPath="< complete path to the db >"

    set db=opendatabase(dbPath)
   
    sql="select * from table where <criteria string >"

    set rs=db.openrecordset(sql)

   
what are you trying to do ?
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 36475457
..to continue, you can then display the result with

     worksheets("sheet1").range("a1").copyfromrecordset rs
0
 

Author Closing Comment

by:tgtg7
ID: 36510484
thanks!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

760 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

22 Experts available now in Live!

Get 1:1 Help Now