E
EdGrenzig
RE: “Print Warning†when Printing a continuous type form
Access 2000
I would like below listed program code to warn a user how many pages are
going to print before the program issues the print command after the “print
form command button†is clicked on. The form is a continuous type form and
therefore has multiple pages depending how many records are filtered out.
When clicking on the “Print Command Button†on the form, this could print
hundreds of pages if a user is not careful. Normally they would filter the
records to a few pages before printing, but accidents do happen!
I would like a warning box to pop up on the screen that says
“ Warning: 23 pages are going to print! Do you want to continue?â€
Then you click on Yes or No. The code would have to calculate the number of
pages. 23 is just an example. (another option would be to click on PRINT,
PRINT PREVIEW, or NO EXIT) after the warning is displayed.
The present visual basic code that executes is as follows:
Private Sub Command120_Click()
On Error GoTo Err_Command120_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "Form2"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_Command120_Click:
Exit Sub
Err_Command120_Click:
MsgBox Err.Description
Resume Exit_Command120_Click
End Sub
This code has no print warning. I am not a programmer so I am hoping someone
can give me the code to add the warning or direct me where to get it.
Thanks
Access 2000
I would like below listed program code to warn a user how many pages are
going to print before the program issues the print command after the “print
form command button†is clicked on. The form is a continuous type form and
therefore has multiple pages depending how many records are filtered out.
When clicking on the “Print Command Button†on the form, this could print
hundreds of pages if a user is not careful. Normally they would filter the
records to a few pages before printing, but accidents do happen!
I would like a warning box to pop up on the screen that says
“ Warning: 23 pages are going to print! Do you want to continue?â€
Then you click on Yes or No. The code would have to calculate the number of
pages. 23 is just an example. (another option would be to click on PRINT,
PRINT PREVIEW, or NO EXIT) after the warning is displayed.
The present visual basic code that executes is as follows:
Private Sub Command120_Click()
On Error GoTo Err_Command120_Click
Dim stDocName As String
Dim MyForm As Form
stDocName = "Form2"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False
Exit_Command120_Click:
Exit Sub
Err_Command120_Click:
MsgBox Err.Description
Resume Exit_Command120_Click
End Sub
This code has no print warning. I am not a programmer so I am hoping someone
can give me the code to add the warning or direct me where to get it.
Thanks