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
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

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)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,521
Messages
5,837,829
Members
430,517
Latest member
chessypack86

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top