Export file with parameter in file name

  • Thread starter Thread starter data123
  • Start date Start date
D

data123

How do I export a file with a specific parameter as the file name? Fo
instance I wanted to name the file based on the specific field in th
report
I am running muliple reports for muiltple users and I want to name th
report based on the user Id I'm running the report on.

I tried usin
c:\[reports]![test]!_usagereport.rtf as the file name but
getting an error.

How do I fix this
 
Hi Tawana,

Presumably you have the user ID available as a parameter when the report
opens (e.g. in a textbox on a form).

Instead of opening the report and then exporting it, put a button on
the form that calls DoCmd.OutputTo to output it directly to RTF format
with the file name you need. It will look something like this (assuming
the textbox displaying the user ID is called txtUserID):

DoCmd.OutputTo acOutputReport, "MyReport", acFormatRTF, _
"C:\" & Me.txtUserID & ".rtf", -1

Change the -1 to 0 if you don't want the report to open in Word once
it's exported.




On Thu, 11 Aug 2005 11:47:39 -0500,
How do I export a file with a specific parameter as the file name? For
instance I wanted to name the file based on the specific field in the
report.
I am running muliple reports for muiltple users and I want to name the
report based on the user Id I'm running the report on.

I tried using
c:\[reports]![test]!_usagereport.rtf as the file name but I
getting an error.

How do I fix this?
 
Back
Top