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!

Save report to .RTF format

Status
Not open for further replies.

RangerFan

MIS
May 4, 2000
61
US
I am trying to save reports in a .rtf format. I am reading
in a table containing different territory designations. I
then take the territory value for each row and run a report
against that value using code similar to the following:

Dim x As String
x = 1

Do While x < 4
DoCmd.OpenReport &quot;ReportName&quot;, acNormal, , &quot;lognumber = &quot; & x
x = x + 1
Loop

This code works fine and sends a seperate report for each
territory to the printer. However, I was wondering if there
is a way to create a .rtf file with a different name for each report to disk file instead of printing a report?

Any help would be appreciated.
 
Hi, here is the VBA code to automatically output a file, you will just need to change the &quot;Destination File&quot; And obviously replace my &quot;i&quot; with your counter (I believe you were using &quot;x&quot;)

Function Output()
On Error GoTo Output_Err
Dim i As Integer
i = 1

DoCmd.OutputTo acReport, &quot;[Report Name]&quot;, _
&quot;RichTextFormat(*.rtf)&quot;, _
&quot;[Destination File]&quot; & i , False, &quot;&quot;


Output_Exit:
Exit Function

Output_Err:
MsgBox Error$
Resume Output_Exit

End Function

Let me now whether or not this works for you...

Kyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top