Automate report output to .snp in Macro

G

Guest

Guys,
I have two reports in Access that I currently output in printpreview using a
Macro. Once I get the Print Preview, I have to manually go in and then click
on Export, then choose the location (path) of where to save my respective
reports and type in a file name. Is there anyway to just have the Macro
Output the reports directly into .snp format and have them be issued a
filename like report1 050205 and report2 050205?

I know this may have been asked before, but I am an intermediate at this
stuff. I don't know the Visual Basic code that well yet, therefore your
recommendations on what to do on the Macro detail section are much
appreciated in advanced.

Gabe
 
S

SusanV

Hi Chicago,

Instead of choosing OpenReport from the actions list, choose OutputTo. Then
select the report and the options you want.
 
G

Guest

SusanV,
Thanks for this. Ok now within that Macro in Access, how do I get it to
stamp the date and time on the filename each time I go to save it so that it
doesn't save it over a previous version?
Please advise. Thanks!
-Gabe
 
S

SusanV

Formatting the filename within the Macro? Not sure if it's possible. I know
you stated you don't feel comfortable with VBA, but if you create a public
function in a module, you can call the function from anywhere - button,
macro, whatever. And the code is really quite simple. This is an example of
a function I use for the same purpose:

'''''''''''''''''''''''''''''''''''''''''''''''''
Function ReportDate()
strFileName = "C:\temp\MyReport" & Format$(Date, "mm-dd-yy") & ".snp"
DoCmd.OutputTo acReport, "repMyReport", "SnapshotFormat(*.snp)",
strFileName, False, ""
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''

Compile and save the module, then in your macro, choose RunCode and insert
the Function Name, in this case ReportDate().
Save the Macro and run it - in this example, the snapshot file of the report
repMyReport will be created in C:\Temp\ folder as MyReport05-03-05.snp

If this isn't clear, post back. =)
 

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