Opening a saved Snapshot Report from Access

K

Kevin Dunn

Hi,

I am looking for a way to open saved Snapshot Reports from Access. I want
to allow users to select a saved report (e.g., TestReport.snp) from within
Access using the File Dialog box and then have that report open up in a
separate window.

I tried adding the Snapshot Viewer control to a form and opening the reports
that way, but it doesn't give users the same flexibility as when they open
the report by double clicking on it. How can I achieve this same effect in
Access without necessarily using the Snapshot Viewer object? I also tried
using the Shell function but with no success because I didn't know how to
pass the report name to the Snapshot Viewer once it was opened. I'm using
Access 2002 in Windows XP. Any help on this would be greatly appreciated.
Thanks.

Kevin

'CODE SAMPLES
retVal = Shell("C:\Program Files\Common Files\Microsoft Shared\Snapshot
Viewer\SnapView.exe", 1)
----------------------------------------------------------------------------------------------------------

Set dlgOpen = Application.FileDialog(msoFileDialogOpen)

'Set default file folder
dlgOpen.InitialFileName = "W:\Saved Reports"

'Display FileDialog box
''dlgOpen.Show

'Perform if user selected a report
If dlgOpen.Show = -1 Then
For Each varItem In dlgOpen.SelectedItems
'User selected the report "TestReport.snp"
strFileName = varItem
Next varItem

'Show selected report
DoCmd.openForm "frmSnapshotReport_new"
Forms!frmSnapshotReport_new!snpViewer.SnapshotPath = strFileName
Forms!frmSnapshotReport_new.Caption = Mid(strFileName, 18)
End If
----------------------------------------------------------------------------------------------------------
 
C

Carl Rapson

Kevin Dunn said:
Hi,

I am looking for a way to open saved Snapshot Reports from Access. I want
to allow users to select a saved report (e.g., TestReport.snp) from within
Access using the File Dialog box and then have that report open up in a
separate window.

I tried adding the Snapshot Viewer control to a form and opening the
reports that way, but it doesn't give users the same flexibility as when
they open the report by double clicking on it. How can I achieve this
same effect in Access without necessarily using the Snapshot Viewer
object? I also tried using the Shell function but with no success because
I didn't know how to pass the report name to the Snapshot Viewer once it
was opened. I'm using Access 2002 in Windows XP. Any help on this would
be greatly appreciated. Thanks.

Kevin

'CODE SAMPLES
retVal = Shell("C:\Program Files\Common Files\Microsoft Shared\Snapshot
Viewer\SnapView.exe", 1)
----------------------------------------------------------------------------------------------------------

Set dlgOpen = Application.FileDialog(msoFileDialogOpen)

'Set default file folder
dlgOpen.InitialFileName = "W:\Saved Reports"

'Display FileDialog box
''dlgOpen.Show

'Perform if user selected a report
If dlgOpen.Show = -1 Then
For Each varItem In dlgOpen.SelectedItems
'User selected the report "TestReport.snp"
strFileName = varItem
Next varItem

'Show selected report
DoCmd.openForm "frmSnapshotReport_new"
Forms!frmSnapshotReport_new!snpViewer.SnapshotPath = strFileName
Forms!frmSnapshotReport_new.Caption = Mid(strFileName, 18)
End If

You might be able to use Application.FollowHyperlink instead of Shell,
passing it the name of the Snapshot file to be opened. FollowHyperlink uses
the appropriate default application to open any file (Word for a .doc file,
for example, or Excel for a .xls file). It should work with Snapshot files
as well.

Carl Rapson
 
K

Kevin Dunn

Thanks Carl, that's exactly what I needed. The Application.FollowHyperlink
works like a charm.

Kevin
 

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