LPARAMETERS startdate, enddate LOCAL cycle, tocycle, testdate, ret_val ret_val = 0 tocycle = enddate-startdate FOR cycle = 0 TO tocycle testdate = startdate + cycle IF .NOT. INLIST(DOW(ScanDay,1), 6, 7) && friday, saturday ret_val = ret_val + 1 ENDIF ENDFOR RETURN ret_val3. Change the lastline of Yourcode:
thisform.text3.value=thisform.CalculateDays(thisform.text1.value,thisform.text2.value)BTW neither Function not Method or procedure can Have parameters with names thisform.xxxx
>*thisform.text1.value=startdate >*thisform.text2.value=enddate >thisform.text3.value=CalculateDays(thisform.text1.value,thisform.text2.value) > > >FUNCTION CalculateDays(thisform.text1.value, thisform.text2.value) > LOCAL cycle, tocycle, testdate, ret_val > ret_val = 0 > tocycle = enddate-startdate > FOR cycle = 0 TO tocycle > testdate = thisform.text1.value+cycle > IF .NOT. INLIST(DOW(ScanDay,1), 6, 7) && friday, saturday > ret_val = ret_val + 1 > ENDIF > ENDFOR > >RETURN ret_val > >>