Export report

le888

Registered User.
Local time
Today, 18:57
Joined
Dec 10, 2003
Messages
344
Hi

I have a button that I click on it and it export my report. However, is it pssible to identifier a pathway automatically. I have try this code but it gives me an error message.

DoCmd.OutputTo acReport, stDocName, , C:\Access\Tasks

What is the problem?

Thanks,

Le
 
what is the error message? One thing I do notice is that your path doesn't have quotation marks around it (required if not using a string variable).
 
Thanks, I have add the quotation marks and it gives me the message say that

"Microsoft Access cann't saved this output data in a file that I have selected."

Le
 
If you are going to send it to a file, you need the WHOLE path (including file name). If you leave that part blank then it should prompt you for the path and name.
 
Thanks, I have put in the blank :

DoCmd.OutputTo acReport, stDocName, MS - Dos, "C:\Access\Tasks"

This don't work, the message is that the format is not right. So, what is the syntaxe of this command?

Le
 
If you hit F1 while you have your cursor in the code OutputTo then you will get the help file up with all of the acceptable output types. And, you still show that you are not putting the file name correctly. C:\Access\Tasks is not a file name; it is a folder. C:\Access\Tasks\MyOutput.xls is a file name.
 
Still don't work!!

Here is the code:

DoCmd.OutputTo acReport, stDocName, MS - Dos, "C:\Access\Tasks\Projet1.txt"

Still message shows that the format is missing.

Le
 
MS-Dos does not look like one of the allowed options. Do the help file thing (I don't have Access available to me at the moment) like I suggested. Put your cursor in your code window right in the word OUTPUTTO and hit F1
 

Users who are viewing this thread

Back
Top Bottom