[AccessD] Report based on filters...

kost36 at gmail.com kost36 at gmail.com
Thu Oct 5 12:48:34 CDT 2023


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



More information about the AccessD mailing list