Automating importing data from access into excel into multiple fields

joeray1983

New Member
Joined
Jul 28, 2010
Messages
6
Hello,

This topic may have been touched on here before, but as I am new to the forums please bear with me.

I have designed a query in access to pull information from a database.

However since this report will be used regularly, I wanted to automate the process by using VBA. Any suggestions on how to code this in VBA if I wanted to pull information from multiple queries within the database, and have that information populate into specific cells in excel?

Any help would be greatly appreciated.

Cheers,

Joe
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Welcome to the Board!

Excel has a built-in tool to pull data from external sources. IN 2007+ goto Data-->From Access & follow the wizard. You will be prompted for where you want to put the query result(s).

In earlier versions goto Data-->Import External Data-->New Database Query & follow the wizard.

Once you have it set up you can set a refresh interval, have it refresh on open or refresh it from VBA.

HTH,
 

joeray1983

New Member
Joined
Jul 28, 2010
Messages
6
Smitty,

Thanks for the quick response! I considered this option, however the person requesting the report wants it to be pretty much hands free report generation. As in: Insert a button in excel, click it, and viola! Theres your information concerning the project that the queries are mining the data for. So unfortunately I dont think this will work. Any other suggestions?

Thanks Again,

Joe
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Well,

You can record a macro running through the steps I outlined above. VBA will capture all of the correct path information for you.

If you build a list of available queries, you can prompt the end-user to select one from the list, and ask them to provide the cell address where they want the result(s).

E.G.

Destination:=Range(UserPrompt/Selection)).QueryTable
.CommandText = Array(UserPrompt/Selection)
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,916
Messages
5,514,131
Members
408,985
Latest member
bchaabi

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top