Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating an output to a file instead of a report

Status
Not open for further replies.

leslied

MIS
May 29, 2003
108
0
0
US
How do you output information from a query to a file, for example for disk transfer, rathern than outputting it to a report?


I apprecaite your feed backs.


Reagrds.
 
Using the menu: File>Export

Using VBA: DoCmd.OutputTo

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
I accept your answer..thank you for that.

What I was actually looking for, and this is my fault, so I apologize for it. Any how, what i really wanted to know is how to make it automatic. For example, when the user hits the generate report button, instead of it actually generating a report it stores it to a file, text file to be specific.

Thanks again
 
What do you mean by the "generate report button"? And is the text file supposed to be formatted like a report, a datasheet, a CSV file, what?

Remember, I know nothing about your application and can't see it. Think out what it is you want and describe it as you would to a blind man.


Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
ok...

I have a query which pulls information i need.
now what i want to do with the query is to send the information it pulls to a file, namely a plain text file. The type of file is not very important at this moment.
Now I want to do a form. On that form i will have a button that runs the query and upon running the query the information is sent to the file destination.

I hope this was helpful enough


Thanks RickSpr
 
Ok. I would have thought the solution was obvious from my first post, then.

In the command button's Click event procedure, execute the code:
DoCmd.OutputTo acOutputQuery, &quot;<name of query>&quot;, acFormatTxt, &quot;<path name of output file>&quot;

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Oh, wait a minute. This outputs a file as a report with lines and boxes--probably not what you meant by a &quot;plain text file&quot;.

Try this instead:
DoCmd.TransferText acExportDelim, , &quot;<name of query>&quot;, &quot;<path name of file>&quot;, True


Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
this is what i did.... is this correct or does it look okay to you?

DoCmd.TransferText acExportDelim, , &quot;<RBC Monthlysal Query>&quot;, &quot;<D:\TEMP\RBC MonthlySal>&quot;, True

because i am getting this error that D:\TEMP is not a valid path


thanks

 
Get rid of the < > symbols, Rick is showing you were to put your names, also you should have a folder on your D: drive called temp.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top