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 / General 1 / January 2006

Tip: Looking for answers? Try searching our database.

Pass Parameter to query via Report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roger - 30 Jan 2006 21:32 GMT
Anyone know how to pass a parameter to a query via a report in Access
2003?
Jeff - 30 Jan 2006 22:40 GMT
If you are going to enter it manually, make it a parameter query and when
the report runs it will ask for the parameter. Will work for multiple
parameters but will pop up a dialog asking for each in turn.

Or you could build a dialog on which you enter the value/s, hide the form
only when showing the report, don't unload it, and have your report query
reference the controls on the dialog to get the value. This solution is good
if you have multiple parameters.

Then in the close event of the report check to see if the dialog is open,
which it should be, then close it.

If there is to be no human entering of the parameter, use a constructed
'where' statement to filter the report.

There are other ways of doing this but this is the method I see used often.
I rarely use it myself as I have built a reporting module that handles
pre-processing, filter dialogs and much more.

Jeff

> Anyone know how to pass a parameter to a query via a report in Access
> 2003?
cjb_kjb - 30 Jan 2006 23:23 GMT
I agree the easiest way is to use a where clause to filter the report.
(have the report's filter on property set to yes)

This is best done though if you are using

Docmd.openreport..... to open the report

Alternatively - if using Access2003 you can pass openargs now to a
report so in the on open event you can use these to modify the report's
recordsource.  You can also modify the recordsource in the on open
event by referencing other objects (eg form, table ....) for criteria.
 
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.