How to automaticaly name a report and save to a location?

P

pokdbz

I have a report called "SummaryReport" that when it is generated I would like
to have it automatically named and saved to a location.

Can this be done? I would like to have the name of ithe file come from
field on my report called "reportName". And saved to the location C:\
 
S

SusanV

You can use this to create a snapshot file of the report. Put it in the
OnClick of a button (or any event you like to trigger the VBA Code)

Dim strName as String
Dim loc As String
loc = "C:\"
strName = me.FieldYouWantToUse

DoCmd.OutputTo acReport, "NameOfYourReport", "SnapshotFormat(*.snp)", loc &
strName & ".snp", False
 
P

pokdbz

Thanks so much, worked perfect.

SusanV said:
You can use this to create a snapshot file of the report. Put it in the
OnClick of a button (or any event you like to trigger the VBA Code)

Dim strName as String
Dim loc As String
loc = "C:\"
strName = me.FieldYouWantToUse

DoCmd.OutputTo acReport, "NameOfYourReport", "SnapshotFormat(*.snp)", loc &
strName & ".snp", False
 
S

SusanV

Sure, I have one I use for Word, for a user who wants to be able to edit it
to mark his progress through the week:

DoCmd.OutputTo acReport, "rep_PMO_Status", "RichTextFormat(*.rtf)", loc &
"PMO_Status_" & Format$(Date, "mm-dd-yy") & ".doc", True

The changes are:
"SnapshotFormat(*.snp)", to "RichTextFormat(*.rtf)", and the file extension
from ".snp" to ".doc"

Keep in mind however that any embedded graphics, including checkboxes, will
not display, as this isn't a true Word doc, but rather an rtf doc which
doesn't support graphic embedding.

Glad to help,

Susan
 
Top