customise 'print report' button

dazza

Registered User.
Local time
Today, 14:53
Joined
Mar 18, 2003
Messages
11
Hiya

I have the following print button on my form:

Private Sub printreport1_Click()
On Error GoTo Err_printreport1_Click

Dim stDocName As String

stDocName = "Courses & Students Report"
DoCmd.OpenReport stDocName, acNormal

Exit_printreport1_Click:
Exit Sub

Err_printreport1_Click:
MsgBox Err.Description
Resume Exit_printreport1_Click

End Sub

Before the document is actually printed, I would like a confirmation box, with merely a YES/NO option, or OK/Cancel.

What would also be nice, is if it would display how many pages are required, but this isn't essential if it's too difficult.

TIA
--
http://www.darrenpowles.net \\ brand new webcam & weblog
http://www.wirelesswales.net \\ bring wales on the right side of the divide
Where do I belong forever, in who's arms, the time and place?
 
try this

Private Sub cmdCopy_Click()
Dim answer As String
On Error GoTo Err_printreport1_Click

answer = MsgBox("Do you really want to print the report?", vbYesNo, "Confirm Print")

If answer = vbYes Then
Dim stDocName As String

stDocName = "Courses & Students Report"
DoCmd.OpenReport stDocName, acNormal
Else
MsgBox "Canceled print"
End If

Exit_printreport1_Click:
Exit Sub

Err_printreport1_Click:
MsgBox Err.Description
Resume Exit_printreport1_Click

End Sub
 
thank you, that works.

note: had to change the following:

Private Sub cmdCopy_Click()

to

Private Sub printreport1_Click()

--
http://www.darrenpowles.net \\ brand new webcam & weblog
http://www.wirelesswales.net \\ bring wales on the right side of the divide
Where do I belong forever, in who's arms, the time and place?
 

Users who are viewing this thread

Back
Top Bottom