Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / January 2008

Tip: Looking for answers? Try searching our database.

Launching a report from a Form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe - 11 Jan 2008 13:40 GMT
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.
Daniel Pineault - 11 Jan 2008 14:36 GMT
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.
Signature

Hope this helps,

Daniel Pineault

> 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.
Joe - 11 Jan 2008 14:45 GMT
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?)

> 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
[quoted text clipped - 8 lines]
> > 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.
Klatuu - 11 Jan 2008 15:01 GMT
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.
Signature

Dave Hargis, Microsoft Access MVP

> 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
[quoted text clipped - 12 lines]
> > > 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.
John Spencer - 11 Jan 2008 15:27 GMT
If you add a report you have to redistribute the application anyway.

I prefer a form based on a table that lists my reports.  The advantage I
find with a table is that I can include a description of the report to
display when the report is selected.  Also, I can include other
information in the reports table.

For instance, I have an archive field in the reports table.  This allows
me (or an administrator) to remove the report from the list of available
reports.  Then when the customer decides that they do want that old
report after all, the adminstrator (or I) unchecks the archive field and
the report is once again available.

For complex applications with many reports I also can sub-categorize
reports by area of interest.

'====================================================
 John Spencer
 Access MVP 2002-2005, 2007-2008
 Center for Health Program Development and Management
 University of Maryland Baltimore County
'====================================================

> 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.
[quoted text clipped - 12 lines]
> 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.
Klatuu - 11 Jan 2008 15:43 GMT
Good idea, John.
True about the redistribution, but in my world it shortens the QA and
implementatin review process.  Only the report has to go through, not the
modified form.
Signature

Dave Hargis, Microsoft Access MVP

> If you add a report you have to redistribute the application anyway.
>
[quoted text clipped - 35 lines]
> > 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.
Joe - 11 Jan 2008 15:57 GMT
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.

> 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.
[quoted text clipped - 29 lines]
> > > > 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.
Klatuu - 11 Jan 2008 16:03 GMT
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.
Signature

Dave Hargis, Microsoft Access MVP

> 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
[quoted text clipped - 37 lines]
> > > > > 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.
Joe - 11 Jan 2008 16:11 GMT
I meant the "proprieties" box. The box that comes up when you right click on
the Combo box.

> 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
[quoted text clipped - 47 lines]
> > > > > > 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.
Klatuu - 11 Jan 2008 16:16 GMT
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.
Signature

Dave Hargis, Microsoft Access MVP

> I meant the "proprieties" box. The box that comes up when you right click on
> the Combo box.
[quoted text clipped - 50 lines]
> > > > > > > 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.
Joe - 11 Jan 2008 18:46 GMT
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.
         

> Okay.  The code for the Query should go directly into the Row Source property.
>
[quoted text clipped - 58 lines]
> > > > > > > > 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.
Klatuu - 11 Jan 2008 19:09 GMT
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

Signature

Dave Hargis, Microsoft Access MVP

> 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.
[quoted text clipped - 77 lines]
> > > > > > > > > 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.
Joe - 11 Jan 2008 20:31 GMT
Now it works but there is one detail, It now goes directly to the printer
instead of the screen first.

> 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:
[quoted text clipped - 82 lines]
> > > > > > > > > > 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.
Klatuu - 11 Jan 2008 20:34 GMT
put the argument in the openreport to make it preview.
See VBA Help for OpenReport method
Signature

Dave Hargis, Microsoft Access MVP

> Now it works but there is one detail, It now goes directly to the printer
> instead of the screen first.
[quoted text clipped - 85 lines]
> > > > > > > > > > > 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.
Joe - 11 Jan 2008 20:44 GMT
Thank you for sticking with me, I saw how to do the preview.
I thank you so much for all of the help.

> put the argument in the openreport to make it preview.
> See VBA Help for OpenReport method
[quoted text clipped - 88 lines]
> > > > > > > > > > > > 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.