Solved

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

Posted on 2011-09-02
3
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

710 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