Consulting

Results 1 to 17 of 17

Thread: Is it possible to automate results from an access query into Excel?

  1. #1
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location

    Is it possible to automate results from an access query into Excel?

    Is it possible to automate results from an access query into Excel?
    Calling all VBA experienced gurus, geniuses etc. I have created several queries in different databases. What I would like to do is rather than running the query, and copy and pasting the results into Excel...I would prefer if the queries were linked to the different databases and automatically displayed the results on a excel worksheet. Can this be done? If so, how can this be done in as straightforward and logical way? I am not an expert at vba...so if you have any example of vba code or steps in access how to perform this process would be very helpful in my learning...


    Thanks for your contributions I appreciate it.

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    You can, subject to certain limitations, link a query directly into an Excel worksheet. Which version of Excel are you using?

  3. #3
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location
    Hi, I am using Excel 2010.

  4. #4
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location
    Aflatoon.

  5. #5
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    In that case:
    Data tab, click From Access, select your database, then select the query you want, choose where you want it put, then OK out. Repeat as required for each query you wish to link to.

  6. #6
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location
    Thanks for that Aflatoon...Is it possible to link all the query results on to the same work sheet?

  7. #7
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Yes - you can put the results anywhere you want.

  8. #8
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location
    Excuse me if this is a silly question. Is this what is automation?

  9. #9
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    No - automation is controlling another application through code. For example, in VBA in Access, you could start an instance of Excel, open a workbook, update some information, then save and close it.
    Be as you wish to seem

  10. #10
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location
    Aflatoon?

  11. #11
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Yes?
    Be as you wish to seem

  12. #12
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location
    Thank you sir!

  13. #13
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location
    Aflatoon, do you know where I can find sample code to perform what I want to do?

  14. #14
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Can you not just set them up manually in the workbook? They will update automatically after that when you open the workbook.
    Be as you wish to seem

  15. #15

  16. #16
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location
    Thanks Kenneth!

  17. #17
    VBAX Mentor
    Joined
    Aug 2010
    Posts
    457
    Location
    I've done exactly that Aflatoon. But I was thinking it would be quicker to run code since I have to update the query every day. Rather than importing data sets into Excel...I thought running code would automatically do the same thing and open the worksheet and display the data load quicker and may save time...I think your idea is good...but it's just incase I have 20 to 30 queries to link to excel could take a longer time...by running code it will be done in an instant if that makes sense.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •