Print From List Box

B

Bobby.Dannels

I created a list box called lstReports. I am trying to have the list
box display all reports in the database. There are two command
buttons, chkPreview and cmdPrintReport. All reports are pulled from
the same table called Data Table or querries that pull the info from
that table. There are also two Option Buttons (optAll and optSection)
with at combo box to filter the reports by a column called Section.
How can I get this setup to work correctly? I am totally lost.
 
D

Daniel Pineault

To build a listbox with a listing of all your reports simply use the code
found at

http://allenbrowne.com/ser-52.html

Then you can simply use the

DoCmd.OpenReport ....

To either open the report to preview it or send it directly to the printer
as your button OnClick events. Simply lookup the commnad the VBE help file
for synthax and examples.
 
B

Bobby.Dannels

The code you sent me to does not deal with listing all reports in a
listbox. The code I did find is the following:

SELECT [Name] FROM MsysObjects WHERE (([Type]=-32764) And ([Name] Not
Like "~*") And ([Name] Not Like "MSys*")) ORDER BY [Name];

When I enter this code into Row Source, my list box displays the names
of all reports. But, none of them are able to be selected. I also need
to know how to point the open report and print report commands to the
item that is selected in the list box.
 
B

Bobby.Dannels

Thank you for the help so far. I have one more thing that I need this
form to do. It is probably a little more complicated.
There are two option buttons optAll and optSection and a combo box
which lists the different section withing the reports. I would like
the combo box to only be accessable when the optSection is selected,
and when a section is selected in the combo box, I would like all
reports to be filtered so that only records belonging to that section
are showed on the reports.
I appreciate all the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top