printer/page setup

associates

Registered User.
Local time
Today, 10:58
Joined
Jan 5, 2006
Messages
94
Hi,

I was wondering if anyone might be able to help me.

I have a form and it has listbox displaying a certain number of records and it also has a button "Print All". What this button does is it would print to the report whatever on the listbox. My question here is because i'd like to let user be able to choose printer/page setup, so i run the command acCmdPrint. My problem is if there is a way to know if the user click on the "cancel" or "print" button under the print popup windows that allows user to choose printer and page setup. The reason for this is if i know that user doesn't want to print, he/she will hit the cancel button and hence, nothing gets printed out. I have a for loop in my code that will continue to print for as many as there are in the listbox.

Here is my code

Private Sub CM_PrintList_Click()
On Error Resume Next
Dim rsNew As New ADODB.Recordset

nList = Me.myList.ListCount
Mtext = "Ready to print" + Str$(nList) + " documents"
If MsgBox(Mtext, 49, "Outline Report Printing") = 1 Then

DoCmd.SelectObject acReport, stDocName
DoCmd.RunCommand acCmdPrint

' --> if i can stop it from going into the loop here if the user decided not to print

If Err.Number <> 0 And Err.Number <> 2501 Then
MsgBox Err.Number & ":" & Err.Description, vbCritical
Else
Err.Clear
End If

For nCount = 0 To nList - 1

' do printing here
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.Close acReport, stDocName, acSaveNo 'Refresh Report
DoCmd.OpenReport stDocName, , , stLinkCriteria

DoEvents
DoCmd.Close acReport, stDocName

Next nCount
End If

Your help is greatly appreciated.

Thank you in advance
 

Users who are viewing this thread

Back
Top Bottom