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 / Modules / DAO / VBA / December 2006

Tip: Looking for answers? Try searching our database.

Applying a filter to DoCmd.OpenReport

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George R - 15 Dec 2006 01:46 GMT
I need to provide the user the capability, from menu choices, to print either
one page of a mailing label report or the entire report. I have made a second
query for the report that produces only the top 30 records (one page). I am
using the following code to produce the full report:
DoCmd.OpenReport "rptStickerLabels", acViewNormal, "qryStickersMail"
When I substitue the following, the report still prints out in its entirety:
DoCmd.OpenReport "rptStickerLabels", acViewNormal, "qryStickersTestPrint"
The query in the last line is the same as the first except that it calls for
the top 30 records.
How can I make this work? Or is there a better way?
Thak you for your considration.
Ken Snell (MVP) - 15 Dec 2006 03:13 GMT
Generally it's better to use the "Where" argument (the fourth argument) of
the DoCmd.OpenReport method for providing a filter to the report. Base the
report on a query that returns all records, then you can pass a string that
represents the WHERE clause of an SQL statement to the report in that
argument.

DoCmd.OpenReport "ReportName", acViewNormal, , "FieldName=SomeValue"

See Help file for more info, or post back with questions.

Signature

       Ken Snell
<MS ACCESS MVP>

>I need to provide the user the capability, from menu choices, to print
>either
[quoted text clipped - 12 lines]
> How can I make this work? Or is there a better way?
> Thak you for your considration.
 
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.