[AccessD] Report based on filters...
Rocky Smolin
rockysmolin2 at gmail.com
Thu Oct 5 13:15:14 CDT 2023
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
>
More information about the AccessD
mailing list