[AccessD] Sub report filter

Arthur Fuller fuller.artful at gmail.com
Tue Jan 13 14:00:17 CST 2015


Aside from what Charlotte wrote, you want to pass a WhereCondition to the
DoCmd command when opening your report. The  syntax for DoCmd.OpenReport is:

DoCmd.OpenReport ReportName:="rptMyReport", View:=acNormal,
FilterName:=qryMyNamedQuery, _
    WhereCondition:= "Mytype = " & myForm.Mycontrol

eThere are a couple more arguments but that's enough to get you started.
For the complete syntax just type "DoCmd.OpenReport" and then press the
spacebar.

Arthur

On Tue, Jan 13, 2015 at 2:44 PM, Charlotte Foust <charlotte.foust at gmail.com>
wrote:

> "Type" is a keyword in Access and VBA.  It's not a good field name.  Label
> it whatever you like on the form or report, but change the field name!
>
> Charlotte
>
> On Tue, Jan 13, 2015 at 11:14 AM, Gordon Stubbs <gordons2 at pacbell.net>
> wrote:
>
> > Hello everyone,
> >
> > It's been quite a while since I have asked a question of the group.
> > I have a report with a sub-report with a field "Type".
> > I also have a form with a field "filter-Info".
> > I would like to filter the sub-report field "Type" based on the field
> > "filter-Info".
> > How do I get the sub report to do that.
> > I've tried may ideas and haven't got it to work.
> >
> > If I modify the query type field criteria to match the "filter-Info" info
> > it will filter correctly.
> > How can I modify the query criteria using VBA?
> >
> >
> > Thank you.
> >
> > Gordon
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



-- 
Arthur


More information about the AccessD mailing list