OutPutTo SNP Question

G

Guest

I have inherited a database with the following code to automatically create
an RTF file from a specific record in a specific folder whenever a report is
opened via a certain button on a form that displays the record. The code is
attached to the report itself - the users only know about it from the button.

We want to alter this to use the snapshot format. However, it insists on
creating a file ending in .rtf. The only part of the code I'm not sure of is
the '.PathFile' at the end of the stFileName = statement. It doesn't refer
to anything that shows up in the modules.

Any ideas on how to get this to create the file with .SNP instead of .RTF?

Thanks!
 
G

Guest

Sorry, accidentally hit the Post before pasting in the code. Here it is:

Private Sub Report_Activate()
On Error GoTo Err_Report_Activate
Dim stFileName As String

stFileName = Reports!CSRReportForPrintReportButton1.PathFile
DoCmd.OutputTo acOutputReport, , acFormatSNP, stFileName ' (new coding)
'DoCmd.OutputTo acOutputReport, , acFormatRTF, stFileName (old coding)

Exit_Report_Activate:
Exit Sub

Err_Report_Activate:
MsgBox Err.Description
Resume Exit_Report_Activate

End Sub
 
6

'69 Camaro

Hi, Charles.

..PathFile refers to the CSRReportForPrintReportButton1 report's property of
that name (which is the name of the field that the report is bound to), or
else it's the name of a control on that report. Find the PathFile field in
the report's Record Source Property or the Control Source Property of the
control of that name, and it will show you where the file name is being
derived from. You'll need to change this value from "whatever.RTF" to
"whatever.SNP" in order for it to be propogated to the correct file name.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Guest

Many thanks!

It was a hidden control within the report. I altered its reference to .SNP
instead of .RTF and all is well with the world.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top