Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Macros / February 2006

Tip: Looking for answers? Try searching our database.

how to save snapshot reports with different names via macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SystemsInfo - 20 Feb 2006 19:10 GMT
I have completed a macro that saves multiple reports in snapshot format.  The
macro repeats for each consecutive report to be saved.  But, I have not been
able to figure out the syntax (if any) to allow the snapshot report to have a
saved file name different than the initial name indicated in the Output File
of the macro.  

Is it possible to use the OutputTo, Output File to do this automatically?
Steve Schapel - 20 Feb 2006 19:56 GMT
SystemsInfo,

Yes, this is possible.  Can you please give an example of what you want?
 Thanks.

Signature

Steve Schapel, Microsoft Access MVP

> I have completed a macro that saves multiple reports in snapshot format.  The
> macro repeats for each consecutive report to be saved.  But, I have not been
[quoted text clipped - 3 lines]
>
> Is it possible to use the OutputTo, Output File to do this automatically?
SystemsInfo - 20 Feb 2006 20:08 GMT
I would like to place some type of syntax in the Output File line of the
OutputTo line of the macro.  

Example:  C:\My Documents\Snapshot Files\FileName.snp

The FileName.snp will have to change each time the macro repeats.

I have tried syntax for the FileName.snp like [Forms]![frm-MassMailing
List].[CustName].snp.  It loops ok, but all reports are saved with the one
file name.

> SystemsInfo,
>
[quoted text clipped - 8 lines]
> >
> > Is it possible to use the OutputTo, Output File to do this automatically?
Steve Schapel - 21 Feb 2006 01:05 GMT
SystemsInfo,

If the macro is being called from an event on the frm-MassMailing List
form, you can do like this...
 ="C:\My Documents\Snapshot Files\" & [CustName] & ".snp"

But are you using a separate OutputTo action for each report?  Or What
are the details of what you are doing so far?  And how is the macro
supposed to know which CustName to use?  If there is supposed to be a
different file produced for each CustName, you may need to use a
GoToRecord/Next action in the macro, or some such, but tat this stage
just shooting in the dark because I can't envisage your setup there.

Signature

Steve Schapel, Microsoft Access MVP

> I would like to place some type of syntax in the Output File line of the
> OutputTo line of the macro.  
[quoted text clipped - 6 lines]
> List].[CustName].snp.  It loops ok, but all reports are saved with the one
> file name.
SystemsInfo - 21 Feb 2006 13:28 GMT
Steve,

Ok, the details are as follows:

Macro A is called via button click.
Macro A:   Run Macro B, Repeat 100

Macro B:  
1.   Open Form    frm-MassMailing
View Form
Data Mode  Read Only
Window Normal
2.  Run Macro
Macro Name   Macro C
3.   GoTo Record
Object Type   Form
Obj Name  frm-MassMailing
Record   Next
Offset 1

Macro C
1.   Open Report
Report Name  rpt-MassMailing
View   Print Preview
Where Condition  (This works fine, and is lengthy, so omit)
2.   OutputTo
Object Type  Report
Object Name  rpt-MassMailing
OutputFormat  Snapshot Format
Output File C:\My Documents\Snapshots\CustName.snp
Auto Start  No
3.   Close
Object Type report
Object Name  rpt-MassMailing
Save  No

Please note everything works with the exception of the save by CustName.  
Each report does save, but each overwrites the previous save due to the Ouput
File.  Maybe there is a syntax that will work.  I tried the ...\" &
[rpt-MassMailing] & ".snp" but no-go.

> SystemsInfo,
>
[quoted text clipped - 19 lines]
> > List].[CustName].snp.  It loops ok, but all reports are saved with the one
> > file name.
Steve Schapel - 21 Feb 2006 17:54 GMT
SystemsInfo,

Well, it wouldn't be ...\" & [rpt-MassMailing] & ".snp" would it?  I
thought you wanted the CustName in the name of the output file?  You
already have a GoToRecord/Next action in the macro, so I am guessing
that there is a CustName control on the frm-MassMailing form, no?  If
so, I think it would be:
 ...\" & [Forms]![frm-MassMailing]![CustName] & ".snp"

It is good that you r macro is working otherwise.  However, I think
actions 1 and 3 in Macro C are redundant and can be removed.  I can see
no advantage in opening the report in Preview mode and then closing it
again.  And then I think I would myself be tempted to simplify like this...

Macro A is called via button click.
Macro A:
1.   Open Form    frm-MassMailing
View Form
Data Mode  Read Only
Window Normal
2.  Run Macro B, Repeat 100

Macro B:
1.   OutputTo
Object Type  Report
Object Name  rpt-MassMailing
OutputFormat  Snapshot Format
Output File ="C:\My Documents\Snapshots\" &
[Forms]![frm-MassMailing]![CustName] & ".snp"
Auto Start  No
2.   GoTo Record
Object Type   Form
Obj Name  frm-MassMailing
Record   Next

...or, if the button to run this is in fact on the frm-MassMailing form,
like this...

Macro A is called via button click.
Macro A:
1.  Run Macro B, Repeat 100

Macro B:
1.   OutputTo
Object Type  Report
Object Name  rpt-MassMailing
OutputFormat  Snapshot Format
Output File ="C:\My Documents\Snapshots\" & [CustName] & ".snp"
Auto Start  No
2.   GoTo Record
Object Type   <blank>
Obj Name  <blank>
Record   Next

Signature

Steve Schapel, Microsoft Access MVP

> Steve,
>
[quoted text clipped - 36 lines]
> File.  Maybe there is a syntax that will work.  I tried the ...\" &
> [rpt-MassMailing] & ".snp" but no-go.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.