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 / ActiveX Controls / May 2005

Tip: Looking for answers? Try searching our database.

SnapshotViewer control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
EdwardH - 15 May 2005 18:44 GMT
I am trying to open snp file programmatically and then print:
 
Dim snp As SnapshotViewer
Dim stThisFile As String, stSnapFolder As String

stThisFile = stSnapFolder & lstSNPFiles.Value
snp.SnapshotPath = stThisFile
snp.FirstPage

Appreciate assistance!
Arvin Meyer - 15 May 2005 21:12 GMT
If you want to display it first, you'll need to use the Snapshot control on
an Access form, or just open the snapshot using the ShellExecute api:

http://www.mvps.org/access/api/api0018.htm

Using this, there is a print putton right on the viewer.

To print directly from Access code, you'll need to set a reference to the
Snapshot ActiveX control (This should happen automatically if you add the
control to a form, but you'll need to do it manually without the control.)

Also use the New keyword when instantiating an instance of the Snapshot
Viewer in memory to print:

Private Sub cmdSnap_Click()

Dim snp As New SnapshotViewer
Dim stThisFile As String
Dim stSnapFolder As String

stThisFile = stSnapFolder & lstSNPFiles.Value
snp.SnapshotPath = stThisFile
snp.PrintSnapshot False ' False hides the dialog

End Sub
Signature

Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

> I am trying to open snp file programmatically and then print:
>
[quoted text clipped - 6 lines]
>
> Appreciate assistance!
EdwardH - 17 May 2005 10:57 GMT
Arvin
Have placed control on form as you suggest.
Am getting "Method 'Print Snapshot' of object 'ISnapshotViewer' failed" on
that line.
What have I done wrong?

> If you want to display it first, you'll need to use the Snapshot control on
> an Access form, or just open the snapshot using the ShellExecute api:
[quoted text clipped - 31 lines]
> >
> > Appreciate assistance!
Stephen Lebans - 18 May 2005 03:03 GMT
If you have placed an instance of the SNapshot ActiveX control on your
form then you do not need to create an instance of the object. Just do
something like
Me.THeNameOftheSnapshotCOntrol.SnapshotPath = stThisFile
Me.THeNameOftheSnapshotCOntrol.PrintSnapshot False

I have seen the SnapshotPath property cause the PrintSnapshot method to
fail when it is not properly formatted. Try something like:

stThisFile = "File://" & stSnapFolder & lstSNPFiles.Value

Make sure your stSnapFolder variable contains the full path to the
folder including the Drive character.

Finally the Snapshot interface exposes a property that shows whether the
file you have selected has actually finished loading onto the control.

' Load the file via the SnapshotPath property
Me.THeNameOftheSnapshotCOntrol.SnapshotPath = stThisFile

Do While Me.THeNameOftheSnapshotCOntrol.Object.ReadyState <>4
   DoEvents
Loop

' Now you can ask the control to Print itself
Me.THeNameOftheSnapshotCOntrol.PrintSnapshot False

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.

> Arvin
> Have placed control on form as you suggest.
[quoted text clipped - 44 lines]
> > >
> > > Appreciate assistance!
EdwardH - 18 May 2005 08:49 GMT
Many thanks - success!

> If you have placed an instance of the SNapshot ActiveX control on your
> form then you do not need to create an instance of the object. Just do
[quoted text clipped - 86 lines]
> > > >
> > > > Appreciate assistance!
 
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



©2009 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.