print reports on click

Giganews Newsgroups
Subject: print reports on click
Posted by:  Kil (davidzacharyk…@gmail.com)
Date: 28 Aug 2006

I designed a form that allows the user to enter dates, and click a
checkbox so that certain forms may be loaded.  However, I have had
trouble getting the right information to load.
I would like to enable certain reports to be displayed as the user
checks the box and the clicks the cmdReport button.  Also, is there a
certain way to combine reports, loaded separately, to load into one for
printing (e.g. report1 and report2 are checked, how to concatenate them
into one page)?

Here is the code that I have that works, but severely limited:

Private Sub cmdReport_Click()
    On Error GoTo Err_cmdReport_Click

    Dim stDocName As String

    stDocName = "rptDateParameterReport"

'Check values are entered into Date From and Date To text boxes
'if so run report or cancel request

    If Len(Me.txtdatefrom & vbNullString) = 0 Or Len(Me.txtDateTo &
vbNullString) = 0 Then
        MsgBox "Please ensure that a report date range is entered into
the form", _
              vbInformation, "Required Data..."
        Exit Sub
    Else
        DoCmd.OpenReport stDocName, acPreview
    End If
Exit_cmdReport_Click:
    Exit Sub

Err_cmdReport_Click:
    MsgBox Err.Description
    Resume Exit_cmdReport_Click

End Sub

It works, but only loading one report from the form.  I haven't yet
found or worked out a method that will check to see if the boxes are
checked for more than one report to be loaded at once, and combined.

Thank you!

Replies