PC Review


Reply
Thread Tools Rate Thread

How can you generate an Excel file from a query that has parameter

 
 
mr3316a
Guest
Posts: n/a
 
      15th Apr 2010
In Access 2007, I am currently using the following code to generate an excel
file from a normal select query and it work fine.
In my code, I am building parts of the statement based on data that is
stored in tables.
"s" = a string that represents the name of the query
"p" = a concatenated string that represents the files Path, files Name,
and files extention

DoCmd.OutputTo acOutputQuery, s, acFormatXLS, p, False

My question is what would the code be if the query needed to have parameters
passed in?

Can anyone help me with this?
 
Reply With Quote
 
 
 
 
ryguy7272
Guest
Posts: n/a
 
      15th Apr 2010
Here's one way:
http://www.datapigtechnologies.com/AccessMain.htm

Go to the bottom of the page and download this file: 'DataPig Access
Explosion'

Here's a video on how it works:
http://www.datapigtechnologies.com/f...explosion.html

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"mr3316a" wrote:

> In Access 2007, I am currently using the following code to generate an excel
> file from a normal select query and it work fine.
> In my code, I am building parts of the statement based on data that is
> stored in tables.
> "s" = a string that represents the name of the query
> "p" = a concatenated string that represents the files Path, files Name,
> and files extention
>
> DoCmd.OutputTo acOutputQuery, s, acFormatXLS, p, False
>
> My question is what would the code be if the query needed to have parameters
> passed in?
>
> Can anyone help me with this?

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      15th Apr 2010
Almost forgot about this:
http://www.accessmvp.com/KDSnell/EXCEL_Export.htm

How could I forget about this??!!!!

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"ryguy7272" wrote:

> Here's one way:
> http://www.datapigtechnologies.com/AccessMain.htm
>
> Go to the bottom of the page and download this file: 'DataPig Access
> Explosion'
>
> Here's a video on how it works:
> http://www.datapigtechnologies.com/f...explosion.html
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "mr3316a" wrote:
>
> > In Access 2007, I am currently using the following code to generate an excel
> > file from a normal select query and it work fine.
> > In my code, I am building parts of the statement based on data that is
> > stored in tables.
> > "s" = a string that represents the name of the query
> > "p" = a concatenated string that represents the files Path, files Name,
> > and files extention
> >
> > DoCmd.OutputTo acOutputQuery, s, acFormatXLS, p, False
> >
> > My question is what would the code be if the query needed to have parameters
> > passed in?
> >
> > Can anyone help me with this?

 
Reply With Quote
 
mr3316a
Guest
Posts: n/a
 
      16th Apr 2010
Thanks for your help!
I found you app very interesting, and it gave me a lot of ideas, in
particular instead of gerneration mulipule spreadsheets that I would have to
then create attachments to an e-mail, create 1 spreadsheet with multiples
tabs 1 for each report. Then only have 1 attachment.
Thanks again
Mark

"ryguy7272" wrote:

> Almost forgot about this:
> http://www.accessmvp.com/KDSnell/EXCEL_Export.htm
>
> How could I forget about this??!!!!
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "ryguy7272" wrote:
>
> > Here's one way:
> > http://www.datapigtechnologies.com/AccessMain.htm
> >
> > Go to the bottom of the page and download this file: 'DataPig Access
> > Explosion'
> >
> > Here's a video on how it works:
> > http://www.datapigtechnologies.com/f...explosion.html
> >
> > --
> > Ryan---
> > If this information was helpful, please indicate this by clicking ''Yes''.
> >
> >
> > "mr3316a" wrote:
> >
> > > In Access 2007, I am currently using the following code to generate an excel
> > > file from a normal select query and it work fine.
> > > In my code, I am building parts of the statement based on data that is
> > > stored in tables.
> > > "s" = a string that represents the name of the query
> > > "p" = a concatenated string that represents the files Path, files Name,
> > > and files extention
> > >
> > > DoCmd.OutputTo acOutputQuery, s, acFormatXLS, p, False
> > >
> > > My question is what would the code be if the query needed to have parameters
> > > passed in?
> > >
> > > Can anyone help me with this?

 
Reply With Quote
 
Ken Snell
Guest
Posts: n/a
 
      17th Apr 2010
"ryguy7272" <(E-Mail Removed)> wrote in message
news:FD31EC3E-835A-48BC-9BCF-(E-Mail Removed)...
> Almost forgot about this:
> http://www.accessmvp.com/KDSnell/EXCEL_Export.htm
>
> How could I forget about this??!!!!


<BIG GRIN and CHUCKLE>

--

Ken Snell
http://www.accessmvp.com/KDSnell/



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP: Not able to generate query from excel for access 2007 sam Microsoft Excel Programming 0 7th Jan 2010 05:01 PM
Pop up Form to set parameter of query to generate a report Carl Microsoft Access Queries 2 28th Oct 2007 01:39 AM
Looping to generate reports based on query parameter =?Utf-8?B?anNjY29ycHM=?= Microsoft Access Queries 0 24th May 2005 04:57 AM
Generate a report from unbound text box and parameter query =?Utf-8?B?UmFq?= Microsoft Access Reports 2 15th Mar 2005 03:29 AM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Microsoft Access Queries 1 13th Dec 2004 07:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:29 AM.