RE: Launching a report from a Form

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.
.



Relevant Pages

  • Re: cycle thru recordset filed collection
    ... Dave Hargis, Microsoft Access MVP ... "Mark Kubicki" wrote: ... I have a report where I dynamically build the text to be displayed; ...
    (microsoft.public.access.formscoding)
  • Re: searching a table using multiple criteria
    ... should be the name of a control in your report. ... The code should be in the control source of a control on the form. ... Dave Hargis, Microsoft Access MVP ...
    (microsoft.public.access.modulesdaovba)
  • Re: searching a table using multiple criteria
    ... Dave Hargis, Microsoft Access MVP ... should be the name of a control in your report. ... The code should be in the control source of a control on the form. ...
    (microsoft.public.access.modulesdaovba)
  • RE: Mutliply reports all at once
    ... Before you actually run the report, you need to requery the subform. ... Dave Hargis, Microsoft Access MVP ... "The Uke" wrote: ...
    (microsoft.public.access.reports)
  • RE: Mutliply reports all at once
    ... Uke, I am going to have to work on this a bit and get back to you. ... Dave Hargis, Microsoft Access MVP ... but what does the command button need to do just run report. ...
    (microsoft.public.access.reports)