Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-09-02
3
Medium Priority
?
239 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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…

705 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