To perform a particular task I need to dsiplay sum for debit column in Loantable where DATE is an important factor so that it would show me how much loan given in this month to a person.
My below idea was to display on a form's unbound text box which worked for the whole year. But since the year 2008 started, it shows the sum for last year's (2007). because my criteria is set to match for Month only.
dim rs as dao.recordset
dim sqlstring as string
' <assigning the criterion>
sqlstring = "SELECT Sum(Debit) FROM LOANTABLE WHERE " & myCriteria
set rs = currentdb.openrecordset(sqlstring)
if rs.recordcount>0 then
LoanGivenThisMonth = rs.fields(0).value
LoanGivenThisMonth = 0