[AccessD] Report based on filters...
Paul Wolstenholme
Paul.W at industrialcontrol.co.nz
Thu Oct 5 15:34:47 CDT 2023
I would add the line
debug.print strFilter
to your code and look in the immediate window to discover what the code has
actually achieved.
The next issue is reconciling the recordsource of the report with filter
string to see if they actually work together. If the recordsource has 2
tables there might be an ambiguous filter field.
Paul Wolstenholme
On Fri, 6 Oct 2023 at 07:15, Rocky Smolin <rockysmolin2 at gmail.com> wrote:
> I had this problem th9is week, coincidentally. Instead of figuring out how
> to make the query do what I wanted (I tried making the whole query a
> summation query), I wrote a public function to find the MAX passing the PK
> ID to the function, calling out the cushion as one of the fields in the
> query.
>
> For me, the workaround was faster than the "correct" solution.
> HTH
>
> r
>
>
> On Thu, Oct 5, 2023 at 10:48 AM <kost36 at gmail.com> wrote:
>
> > Hey group,
> > I use a form "T_kritkos" with field ID_kritikos
> > and a subform "ST_katigoria" with fields: ID_kritikos, year_subscr (keeps
> > the year's subscription) and tameio_ok (check box 0 means chargeable
> > subscription and -1 means paid subscription)
> > What I need is to open a report filtered on ID_kritikos and only the last
> > year_subscr when the tameio_ok =-1
> > e.g
> > 12 | 2023 | paid
> >
> > I tried various versions but in none of them I managed to bring the
> > desired result
> > The last version I am trying is:
> > Dim strFilter As String
> > strFilter = "[ID_kritikos] = " & Forms![T_kritikos]![ID_kritikos] & " AND
> > [tameio_ok] = -1 AND [year_subscr] = (SELECT MAX([year_subscr]) FROM
> > [ST_katigoria] WHERE [ID_kritikos] = " &
> Forms![T_kritikos]![ID_kritikos] &
> > ")"
> > DoCmd.OpenReport "myreport", acViewPreview, "", strFilter
> >
> > The filter works fine on ID_kritikos but it also returns all the records
> > of it and not the last one paid
> > Any ideas please?
> > Thank's
> > /kostas
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list