>How to get the number of monts when date1 is substracted from date2?
Since months don't have fixed length, the QUAD method I use is:
FUNC NumMonths
LPARAMETER tdDate1, tdDate2
RETURN ABS((YEAR(tdDate1)*12+MONTH(tdDate1)) - (YEAR(tdDate2)*12 + MONTH(tdDate2)))