Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

“Print Warning†when Printing a continuous type form

Discussion in 'Information Technology' started by EdGrenzig, Nov 3, 2005.

  1. EdGrenzig

    EdGrenzig
    Expand Collapse
    Guest

    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
     
  2. Joseph Meehan

    Joseph Meehan
    Expand Collapse
    Guest

    Re: "Print Warning" when Printing a continuous type form

    EdGrenzig wrote:
    > 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


    I did that on a couple of projects, but I don't have the code I used.
    However if I remember correctly I made the determination not by counting the
    number of pages but by using a count of the number of records to be used.


    --
    Joseph Meehan

    Dia duit
     
  3. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    Re: "Print Warning" when Printing a continuous type form

    'small number just for testing -
    'calculate your average number of
    'records per page
    Const lngcRecordsPerPage = 3

    Dim lngPages As Long
    Dim intResponse As Long

    'divide number of records by records per page, round up
    lngPages = MyForm.RecordsetClone.RecordCount \ lngcRecordsPerPage _
    + Abs((MyForm.RecordsetClone.RecordCount Mod lngcRecordsPerPage) <>
    0)
    intResponse = MsgBox("This will print " & CStr(lngPages) & _
    " pages. Continue?", vbYesNo)
    If intResponse = vbYes Then
    'print
    Else
    'don't
    End If


    --
    Brendan Reynolds


    "EdGrenzig" <EdGrenzig@discussions.microsoft.com> wrote in message
    news:512F05F6-02BC-4259-9DB2-F3E27D6D4E0F@microsoft.com...
    > 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
    >
    >
    >
    >
     

Share This Page