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

Save a file without specifiying a directory

Status
Not open for further replies.

Jackie

MIS
Feb 9, 2000
148
US

How do I save a file (using the OutPutTo command) without hardcoding a specific drive? I want the directory to be relative to the current directory.

Below is the code that I use. The error message, "Can't save the output to the file you've selected." is displalyed when the Outputto command is executed.

Private Sub Report_Page()

'Identify a variable to hold the report file name
Dim strReportName As String

'Establish the report file name
strReportName = "\\PM_Reports\" & Right(Reports!PM_Proj_Num!Text95, 5) & "." & "rtf"

'Save the report to a file
DoCmd.OutputTo acReport, "PM_Proj_Num", "RichTextFormat(*.rtf)", strReportName

'Close the report to contine processing the remaining Program Managers' reports
DoCmd.Close acReport, "PM_Proj_Num"

End Sub


-jackie
 
check hte HELP topic "Outputto". It does not include "File" as ObjectType. MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
The Outputto statement in my code was based on an OutputTo Macro that was converted to VB.

The Outputto portion works, it stops when it encounters the filename.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top