ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Access query in VBA (https://www.excelbanter.com/excel-programming/321183-access-query-vba.html)

Laurent M

Access query in VBA
 
Hello !

I'm currently developping an Excel-Access application. I would like, for my
import/export function in VBA, to use pre-saved access query in my vba code

Is it possible to do so? How?

Many thanks

Nick Hodge

Access query in VBA
 
Laurent

Certainly

It's easier to set up if you record yourself (ToolsMacros...Record new
macro) doing the following

DataExternal DataNew Database Query... Select MS Access as the source
Navigate to the databaseSelect the queryComplete the rest of the
wizardReturn Data to Excel.

If you then press Alt+F11, you will find the code written for you in
'Module1'

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Laurent M" wrote in message
...
Hello !

I'm currently developping an Excel-Access application. I would like, for
my
import/export function in VBA, to use pre-saved access query in my vba
code

Is it possible to do so? How?

Many thanks




Laurent M

Access query in VBA
 
thanks nick your answer seems nice, but i don't have time to test it yet

jim i dont 't get where you specify the access query, i'm actually quite a
beginner in vba

Jim Thomlinson[_3_]

Access query in VBA
 
Stic with Nick's suggestion. Mine is a little more advanced in that you dont
specify the query but rather the SQL statement that generates the query
results...

"Laurent M" wrote:

thanks nick your answer seems nice, but i don't have time to test it yet

jim i dont 't get where you specify the access query, i'm actually quite a
beginner in vba



All times are GMT +1. The time now is 05:10 PM.

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