option to send report to snapshot

R

Ray S.

I posted this within a prior question hoping to get a reply, but nobody
answered, so I'm posting my own question.

I have a form where the user clicks on a button, which returns to him a
print preview of a report...I'd like for him to then have the option of
sending the output of that previewed report to a snapshot file. I tried to
create a macro, but i don't really follow how to use that...I
tried, but can't figure out how to create the macro...I viewed my uderlying
code for the button and see where the DoCmd.OpenReport "whatever", acPreview
line is, but I don't know how to incorporate the Do.Cmd.OutputTo
acOutputReport,
"whatever", "Snapshot Format", "filepath" to give the user the option to send
the previewed report to a snapshot. Can anybody help?
 
H

Hunter57

Hi Ray,

It is a little hard to find but it is easy to do. Click on your Report.
Then Click on "File", then select "Export". A Windows dialog window appears.
Click on the "Save As Type" drop down arrow. Down near the bottom of the
list you will find "Snapshot Format (*.snp)". Select that and save the
Snapshot in the directory of your choice.

Best Regards,
Patrick Wood
www.advancingsoftware.com
www.churchmanagesoftware.com
 
R

Ray S.

Thanks Hunter57,
I know how to do what you mention, but what I want to do is program an
option after the user previews the report (or maybe put it on the preview
menu) that will automatically output the report to a snapshot at a preset
file location.
 
H

Hunter57

Hi Ray,

Public Function SaveSNP()

DoCmd.OutputTo ObjectType:=acOutputReport, ObjectName:="myReportName", _
OutputFormat:=acFormatSNP, OutputFile:="D:\!1-1-Access\myReportName.snp", _
AutoStart:=True

End Function

The "AutoStart:=True" code automatically opens the snp file you just saved.
You can remove it if you do not want it to do that.

Best Regards,
Patrick Wood
www.advancingsoftware.com
www.churchmanagesoftware.com
 
R

Ray S.

OK, that's better, but I already knew how to do that, too. I want to
incorporate that code into the user interface. As I mentioned, I have a
button on a form that the user clicks and it runs a report and shows him the
print preview of that report. At that point, I want to give the user the
option to save that report he is viewing into a snapshot. I know the code to
send a report to snapshot, but I'm not sure how to present that option at the
point I'm referring to. I thought that maybe I could create a menu option and
have that menu option when selected run the code which you mentioned.
 
H

Hunter57

Hi Ray,

Ok, maybe this will help:

How to create a Custom Shortcut Menu Command for Reports in Preview for
Access 2000-2003.

Open your database.
Right click on the toolbar.
Select "Customize . . ."
A Dialog window appears
Click on the "Toolbars" tab
Click on the "Shortcut Menus" checkbox.
A long bar of Shortcut menus should appear.
On the dialog box select the "Commands" tab.
Click on "File"
In the window click on "Custom" and drag it to the Shortcut Menu Bar.
Drag it to "Report" then "Print Preview" and drop it where you want it to be
in the menu that appears.
Next Right-click on the "Custom" menu item you just placed.
A dialog box opens.
In the "Name" box type in the name you want for the command.
Next go to the bottom and click on "Properties".
A dialog window pops up.
In the "On Action" box enter =MyFunctionName()
Click "Close"
Click "Close" again and you are ready to try your new shortcut menu command.

When you open your Reports in Print Preview, right click, then click on your
command and if all goes well it should work. I know that this works with
functions but I am not sure about subs.

If you have any problems or questions let me know.

Best Regards,
Pat Wood
www.advancingsoftware.com
www.churchmanagesoftware.com
 
R

Ray S.

Thanks Hunter57,

OK, now I think we're on the right track. I did create the custom shortcut,
but the code under it needs refining. I can't put a report name
("myReportName") in:

Public Function SaveSNP()

DoCmd.OutputTo ObjectType:=acOutputReport, _
ObjectName:="myReportName", _
OutputFormat:=acFormatSNP, _
OutputFile:="D:\!1-1-Access\myReportName.snp", _
AutoStart:=True

End Function

this is because the user can select any of twelve different reports from the
initial form. The coding has to use some variable for the report names. The
filepath name will be the same, though, for all reports. The report name will
be the one that the user has selected when he clicked on the appropriate
button to preview it.
 

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