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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving Report in RTF format with ability to choose directory

Status
Not open for further replies.

CodeRage

Programmer
Aug 29, 2002
6
US
I am saving a report to an RTF file using the following command:

DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, , False

I would like to be able to Specify the filename yet have the user Specify the location. Is this possible? So far I have had no luck in doing this. Does anyone have a suggestion on how to do this?
 
In between the "acFormatRTF" and "False" you can place the string expression for the destination file. Something like this:
Code:
DoCmd.OutputTo acOutputReport, stDocName, acFormatRTF, "c:\myfile.rtf", False
 
I tried that, but doing that means that the user can't decide where on their computer they would like the file to go. It is decided for them programatically thus removing their choice in the matter.
 
I just looked in Access help and it says if you run your original statement (leaving the destination blank), the user will be prompted where to put the file. Is that true??
 
Yes, but you cannot create a default file name that the user won't be able to change.

I have found a solution. You have to use save dialog box and return the path to a variable. You can then concatenate the path name with a hard coded file name. You take the variable with the concatenation and insert it into the DoCmd. statement above. It's a real PITA but it seems to work pretty well.
 
I just tested a version of your first command (without the destination) and it gives me an "Output To" dialog box, which allows me to choose the destination and specify the file name.

You're not getting this dialog box??
 
I get the message but don't want the people who use this program to be able to specify the filename. I don't know why, but it's in the program requirements so I have to put it in for the customer. I'd have been done hours ago except for this particular requirement.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top