By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,080 Members | 1,845 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,080 IT Pros & Developers. It's quick & easy.

print reports on click

P: n/a
Kil
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!

Aug 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You cannot combine reports in the way you are asking. If you want to
load multiple reports, you would check your checkbox values in the Else
portion of your If statement.

If Me.YourCheckboxName = True Then
'Open the report
DoCmd.OpenReport "ReportName", acPreview
End IF

Hope that helps!


Kil wrote:
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!
Aug 28 '06 #2

P: n/a
Hi Kil,

If you want to select multiple reports and print them with one click of
the button on your form you could consider the folowing method which I
use sometimes:

Have a form with a list box which lists the available reports, with the
multiselect property set to True.

You can then have the on click event of the command button that
activates the report go through the selected items in the list box and
print them.

Let me know if you need more info.

Phivos


Kil wrote:
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!
Aug 28 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.