Multiple Reports

  • Thread starter Thread starter bdmagnum
  • Start date Start date
B

bdmagnum

Hi to all,
I have a database that has approx. 75 reports. I would like to create
something, possibly a form, that lists all the reports (check boxes?)
were I can select the reports I want and click on one command button to
print the reports selected. Not really sure how to do this and would
appreciate any help.

Thanks,
Bill
 
You can get started with this technique:

Create a listbox that lists all of the reports.
Use a query similar to this one for the listbox:
SELECT DISTINCTROW MSysObjects.Name, MSysObjects.Type
FROM MSysObjects
WHERE MSysObjects.Type=-32764
ORDER BY MSysObjects.Name;

Create a button named "Print Preview".
The code below runs whatever report is selected in the list box.
Add this code to the On Click Event Procedure of the button:

Private Sub Print_Preview_Click()
On Error GoTo Err_Print_Preview_Click

Dim DocName As String
DocName = [Forms]![Report Menu]![RptList]
DoCmd.OpenReport DocName, A_PREVIEW

Exit_Print_Preview_Click:
Exit Sub

Err_Print_Preview_Click:
Select Case Err.Number
Case 2501
'ignore the Canceled Report Error you get when the report No Data
event is set to Cancel=True.
Case Else
MsgBox ("Error # " & Str(Err.Number) & " was generated by " &
Err.Source & Chr(13) & Err.Description)
Resume Exit_Print_Preview_Click
End Select

End Sub
 
Joe,
Thanks for your reply. I did as you said and now when I click on the
command button, I receive "Error #94 was generated by BARRACKS 783
Invalid use of Null". Can you help?

Thanks,
Bill
 
You need to debug your code and report.

Run the report "directly" - does it work or do you get the error?

If the report works then stpe through the ocde one line at a time until you
get the error and then resolve it.
 
Back
Top