Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print multiple snapshots 1

Status
Not open for further replies.

mentasses

Technical User
Mar 23, 2004
29
GB
In my Access database users print reports to mail to suppliers about queries on invoices.

I want them to be able to save these reports in a file and print them all together at the end of the day.

I have created an output to file command button that saves the reports as a snapshot. Saving to his format seems to be the only way to retain choices made in check boxes when the report is printed.

CODE:
Private Sub PrintToFile_Click()
On Error GoTo Err_PrintToFile_Click
Dim stDocName As String
stDocName = "Letter1"
DoCmd.OutputTo acReport, stDocName, acFormatSNP
Exit_PrintToFile_Click:
Exit Sub
Err_PrintToFile_Click:
MsgBox Err.Description
Resume Exit_PrintToFile_Click
End Sub

However, I can not get the reports to print as a batch.

Any Clues?


 
Something like this?:

Private Sub PrintToFile_Click()
On Error GoTo Err_PrintToFile_Click

DoCmd.OutputTo acReport, "Report1", acFormatSNP
DoCmd.OutputTo acReport, "Report2", acFormatSNP
DoCmd.OutputTo acReport, "Report3", acFormatSNP

Exit_PrintToFile_Click:
Exit Sub
Err_PrintToFile_Click:
MsgBox Err.Description
Resume Exit_PrintToFile_Click
End Sub

You can also make things a little easier for the user by creating a file name,dating it if necessary and output to
a directory.

DoCmd.OutputTo acOutputReport, "report1", acFormatSNP, "C:\YourDirectory\" & Title & " Report for" & " - " & Format(Date, "mmmm dd") &".snp
 
Thanks

Just one point.

I do not know how many reports will be printed in any one day.
 
Well, on one job I had a similar setup except that I included minutes as part of the file name. The users would print up to 30 of the same report in one day. They liked snapshots and that was a way to keep them identified.

If it is different reports you are referring to, an option group or a list box might be beneficial to you for making report selections.
 
The reports are all the same format but addressed to different companies.
The number of forms differ each day so I can not set up a rigid output command.
I really need a way of allowing the users to print all the reports that are in a specific folder at the end of business each day and then clear the folder.
I have tried highlighting all the files and selecting print but this only prints the last report.
Any ideas?
 
Disclaimer: I haven't done this and don't know the details, etc.

You could use the SendObject method to e-mail the reports as they are created. Send them to one/more of YOUR employees. At the end of the day they could then be printed, although it would still be a one-at-a-time process.

Or, [idea] They could be forwarded to the receiving company ... As long as they have Snapshot Viewer, they could view or print as they see fit.



HTH,
Bob [morning]
 
Ok, this works - I'm happily sitting here printing out multiple snapshots. Basically on form load, cycle through all the snapshot files and assign their path to the snapshot control one at a time. After each one is assigned, print the snapshot.


Create a new form.
Insert Snapshot Viewer ActiveX Control
In this case it's called SnapshotViewer3

In the form's on load event:

Private Sub Form_Load()

Dim SnpFile As String

SnpFile = Dir("C:\Reports\*.*") 'Directory Path

Do While Not Len(SnpFile) = 0

SnpFile = Dir 'Individual Files


Select Case Len(SnpFile)

Case Is > 0

Me.SnapshotViewer3.SnapshotPath = "C:\Reports\" & SnpFile
Me.SnapshotViewer3.PrintSnapshot False 'do not specify printer

End Select


Loop


Me.Requery

End Sub

You can probably do this with a button too.
 
Update: I moved all this over to a list box so the snapshops can be displayed onClick and Printed onDouble Click.

Private Sub lstSnaps_Click()
'Load Snapshot Viewer with selected Snapshot'
Me.SnapshotViewer3.SnapshotPath = "C:\Snapshots\" & lstSnaps
Me.SnapshotViewer3.Requery
End Sub

Private Sub lstSnaps_DblClick(Cancel As Integer)
Dim SnpFile As String, StSql As String

'Print Options'

If Me.lstSnaps = "Print All" Then

SnpFile = Dir("C:\Snapshots\*.*") 'Directory Path

Do While Not Len(SnpFile) = 0

SnpFile = Dir

MsgBox SnpFile

Select Case Len(SnpFile)

Case Is > 0

Me.SnapshotViewer3.SnapshotPath = "C:\Reports\" & SnpFile
Me.SnapshotViewer3.PrintSnapshot False

End Select

Loop
End If

'Print One Selection'
If Me.lstSnaps <> "Print All" Then

Me.SnapshotViewer3.PrintSnapshot False

End If

Me.Requery


End Sub

Private Sub lstSnaps_Enter()
Dim myfile As String, StSql As String, StSqlF As String

'Create Listbox Rowsource'

myfile = Dir("C:\Snapshots\*.*")

StSql = myfile & ";"

Do While Not (myfile = "")

myfile = Dir

StSql = StSql & myfile & ";"

Loop
'Get rid of extra semicolon'
StSqlF = Replace(StSql, ";;", ";")

'Add Print All'
Me.lstSnaps.RowSource = "Print All;" & StSqlF
End Sub

 
pdldavis

Could you please explain your last post. I am trying to automate the printing process of snp files that are put into folder. I am having a little trouble with the code.

Cheers,
lawboy
 
Hi, I'm on holiday right now. I will be happy to explain next week, if someone else does not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top