Exporting query results to Excel file

  • Thread starter jln via AccessMonster.com
  • Start date
J

jln via AccessMonster.com

What I have is a query that i run to pulling billing information, this query
is ran for each master acct #. What i need is for this to run and then create
an excel file with the account # and date in the filename,each time it is
ran it will create a new excel workbook with query results in a folder called
billings..
 
S

Stefan Hoffmann

hi,
What I have is a query that i run to pulling billing information, this query
is ran for each master acct #. What i need is for this to run and then create
an excel file with the account # and date in the filename,each time it is
ran it will create a new excel workbook with query results in a folder called
billings..
Have a closer look at

DoCmd.TransferSpreadsheet

..


mfG
--> stefan <--
 
J

jln via AccessMonster.com

Im using the DoCmd.TransferSpreadsheet but where im having the problem is
1st setting the folder to create the new workbook.
2nd creating the file name
 
S

Stefan Hoffmann

hi,
Im using the DoCmd.TransferSpreadsheet but where im having the problem is
1st setting the folder to create the new workbook.
2nd creating the file name
Please describe your concrete problem.

DoCmd.TransferSpreadsheet acExport, _
acSpreadsheetTypeExcel97, _
"TableOrQuery", _
"C:\Temp\ExcelFile.xls"


mfG
--> stefan <--
 
J

jln via AccessMonster.com

Let see For each query i have a where statement that ask for the user to
enter the inv number they are wanting. then a table view is opened for that
one query that was ran. So what im wanting to do is have the user enter the
investor number into a text box and have that value used in the where
statement for all of the billing querys that i have. For each inverstor
number a workbook is created that will have a tab for each query. then file
would be saved as what ever inv# was entered and todays Date.xls.
 
S

Stefan Hoffmann

hi,
Let see For each query i have a where statement that ask for the user to
enter the inv number they are wanting. then a table view is opened for that
one query that was ran. So what im wanting to do is have the user enter the
investor number into a text box and have that value used in the where
statement for all of the billing querys that i have. For each inverstor
number a workbook is created that will have a tab for each query. then file
would be saved as what ever inv# was entered and todays Date.xls.
The TransferSpreadsheet method can only create on sheet per workbook.

You'll have to use Excel automation for your task:

http://www.mvps.org/access/modules/mdl0006.htm

http://www.vba-programmer.com/



mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top