i have fields named "Date of Payment" and "Type of Application". i have also unbound textbox with a name "txtCount". i want to display in "txtCount" the total count of records if "Date of Payment" = year 2022 AND "Type of Application" = "New Transaction". The year 2022 is in another table field name "Calendar Year" and the year 2022 is in text159 using: =DLookUp("CalendarYear","tblControlNumber","ControlID")
this is my current formula in my unbound textbox and i am getting error.
=Sum(IIf([Type of Application]="New Transaction" And Year([Date of Payment])=[Text159.Value],1,0))
can anyone help pls, thank you
i want to get Number of New transaction in year 2022 only. and if i update my calendar year 2023, i can also get the number of new transactions in year 2023.


The DLookup() is not complete - WHERE CONDITION needs parameter.
=DLookUp("CalendarYear","tblControlNumber","ControlID=" & [somefield or textbox])