RE: Launching a report from a Form
- From: Klatuu <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 11 Jan 2008 12:34:01 -0800
put the argument in the openreport to make it preview.
See VBA Help for OpenReport method
--
Dave Hargis, Microsoft Access MVP
"Joe" wrote:
Now it works but there is one detail, It now goes directly to the printer.
instead of the screen first.
"Klatuu" wrote:
I should have told you to use your own names. cboReport was just a name I
used for the example. It appears yours should be:
DoCmd.OpenReport Me.Combo0
--
Dave Hargis, Microsoft Access MVP
"Joe" wrote:
I am getting close now I see the list of the reports.
Now when I click on the highlighted report title I get an error.
This is what the screen looks like:
Combo() AfterUpdate
Option Compare Database
Private Sub Combo0_AfterUpdate()
DoCmd.OpenReport Me.cboReports
End Sub
The Error is: Compile error
Method or data member not found
The form is called "Report Select Form"
I appreciate you dealing with me for so long.
"Klatuu" wrote:
Okay. The code for the Query should go directly into the Row Source property.
For the After Update event, you don't put the code there. Right click on
the small command button with the 3 dots just to the right of the property.
Select Event Procedure when the box shows up with the options. The VBA
editor will open with the cursor in the event sub. Put the Docmd.OpenReport
there.
--
Dave Hargis, Microsoft Access MVP
"Joe" wrote:
I meant the "proprieties" box. The box that comes up when you right click on
the Combo box.
"Klatuu" wrote:
I don't understand your question. What parameters box are you talking about?
This actually has nothing to do with parameters. Put the query I posted in
the row source property of the combo box. Then when you open the combo, a
list of all your reports should show. Then with the Docmd.OpenReport in the
combo's After Update event. the report should run once you select it from the
combo.
However, see John Spencer's post. I like his idea of building your own
table with the report names and other info that may be useful.
--
Dave Hargis, Microsoft Access MVP
"Joe" wrote:
You are being very helpful but I am not very smart. I type what you had
except for the letter case and it did not do anything. I entered both of the
lines in the parameters box. I assume certain parts have to have the correct
name instead.
Was I supposed to do somthing after the 3"..." Docmd.OpenReport
Me.cboReports, ....
Sorry for not keeping up.
"Klatuu" wrote:
Listing the reports on the form is not a good idea. Each time you add a new
report, you have to modify and redistribute your appliction.
I would suggest using a combo box to select the report. Here is a query
that will return the name of all reports in your database:
SELECT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Type) =
-32764));
Use that as the row source for the combo. Then in the After Update event of
the combo box:
Docmd.OpenReport Me.cboReports, ....
This way, when you add a new report to your database, there is nothing else
to do. It will be picked up by the query.
--
Dave Hargis, Microsoft Access MVP
"Joe" wrote:
I was just thinking just listing the name on the form and clicking on them. I
assumed I would somehow use the "on dbl click" commend. I do not know what
type of box to use. (commend button?)
"Daniel Pineault" wrote:
Create a form with a listbox which lists all the reports then create a click
or double-click event which opens the selected report using the
Docmd.OpenReport method.
Take a look at http://allenbrowne.com/ser-19.html for an explanation on
how-to build a list of report dynamically.
--
Hope this helps,
Daniel Pineault
"Joe" wrote:
I am sorry to ask this since I saw it yesterday but I can not find it today.
I have 20 reports I would like to select similar to the function of the
switchboard. I have been using the switchboard with sub-switchboards but
obviously there is a better way. I would have the switchboard call this form
and from the form I would click on the report and it would run.
- Follow-Ups:
- RE: Launching a report from a Form
- From: Joe
- RE: Launching a report from a Form
- References:
- RE: Launching a report from a Form
- From: Klatuu
- RE: Launching a report from a Form
- From: Joe
- RE: Launching a report from a Form
- From: Klatuu
- RE: Launching a report from a Form
- From: Joe
- RE: Launching a report from a Form
- From: Klatuu
- RE: Launching a report from a Form
- From: Joe
- RE: Launching a report from a Form
- From: Klatuu
- RE: Launching a report from a Form
- From: Joe
- RE: Launching a report from a Form
- Prev by Date: RE: Launching a report from a Form
- Next by Date: Re: Creating Searchable Database
- Previous by thread: RE: Launching a report from a Form
- Next by thread: RE: Launching a report from a Form
- Index(es):
Relevant Pages
|