ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Querying an Access Database from Excel VBA (https://www.excelbanter.com/excel-programming/345204-querying-access-database-excel-vba.html)

Chaplain Doug

Querying an Access Database from Excel VBA
 
Excel 2003, Access 2003. I want to access a query within an Access database.
The database is called "FEOpen.mdb" and the Query is called "Projects List."
I guess I may be asking how to populate a recordset from Excel VBA using the
Access query. Any help will be appreciated. God bless and thanks.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org

sebastienm

Querying an Access Database from Excel VBA
 
Hi,
Are you trying to display the result of a query in a sheet?
If so, excel has a built-in feature that does just that and does not require
code:
1- in a new blank sheet
2- menu Data Get (or Import) External Data New Database Query. The
'Choose Data Source' dialog pops up.
3- make sure the checkbox 'Use the Query Wizard...' (at the bottom) is
checked. Choose MS Access Database and click ok. The 'Select Database' dialog
pops up.
4- browse to you db file and select it. click ok. The Query Wizard pops up.
5- The Query Wizard displays a list of tables and queries. Select one and
follow the wizard steps.

The wizard is good to build simple queries. Now, if yours is too complex
then in step 3 above, uncheck the 'Use the Query Qizard...'. In that case MS
Query opens (instead of the query wizard) and you should have much more
flexilbility there.

i hope this helps,
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Chaplain Doug" wrote:

Excel 2003, Access 2003. I want to access a query within an Access database.
The database is called "FEOpen.mdb" and the Query is called "Projects List."
I guess I may be asking how to populate a recordset from Excel VBA using the
Access query. Any help will be appreciated. God bless and thanks.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


Chaplain Doug

Querying an Access Database from Excel VBA
 
Dear Sabastien:

Actually I want to populate a record set and do some manipulations and
calculations on the data. Hence, the built-in "external data" capability of
Excel will not suffice. Can you suggest some code that would use the query
and place the results in a record set that I could then process through?
Thanks for any help. God bless.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


"sebastienm" wrote:

Hi,
Are you trying to display the result of a query in a sheet?
If so, excel has a built-in feature that does just that and does not require
code:
1- in a new blank sheet
2- menu Data Get (or Import) External Data New Database Query. The
'Choose Data Source' dialog pops up.
3- make sure the checkbox 'Use the Query Wizard...' (at the bottom) is
checked. Choose MS Access Database and click ok. The 'Select Database' dialog
pops up.
4- browse to you db file and select it. click ok. The Query Wizard pops up.
5- The Query Wizard displays a list of tables and queries. Select one and
follow the wizard steps.

The wizard is good to build simple queries. Now, if yours is too complex
then in step 3 above, uncheck the 'Use the Query Qizard...'. In that case MS
Query opens (instead of the query wizard) and you should have much more
flexilbility there.

i hope this helps,
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Chaplain Doug" wrote:

Excel 2003, Access 2003. I want to access a query within an Access database.
The database is called "FEOpen.mdb" and the Query is called "Projects List."
I guess I may be asking how to populate a recordset from Excel VBA using the
Access query. Any help will be appreciated. God bless and thanks.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


Dick Kusleika

Querying an Access Database from Excel VBA
 
Chaplain Doug wrote:
Dear Sabastien:

Actually I want to populate a record set and do some manipulations and
calculations on the data. Hence, the built-in "external data"
capability of Excel will not suffice. Can you suggest some code that
would use the query and place the results in a record set that I
could then process through? Thanks for any help. God bless.


Try here

http://www.dicks-blog.com/archives/2...ordset-basics/


--
Dick Kusleika
MVP - Excel
Daily Dose of Excel
http://www.dicks-blog.com




All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com