ccount=getfiltercount("mytable", "between(id,521548,529785)") thisform.txt1.value=ccount function getfiltercount(tctable, tcfiltercondition) local lnselect, lncount lnselect = select() && Save current work alias! select 0 use (tctable) again count for &tcfiltercondition lncount = _tally use select(lnselect) return (transform(lncount)) endfunc>How about a UDF that opens a table and closes it again? The following is not tested, but should give you the general idea:
>* Note that in the following command, I omitted the alias. >? GetFilterCount("MyTable", "between(id,1583,1927) and state=='NY'") > >function GetFilterCount(tcTable, tcFilterCondition) >local lnSelect, lnCount >lnSelect = select() && Save current work alias! > >select 0 >use (tcTable) again >count for &tcFilterCondition >lnCount = _tally >use > >select (lnSelect) >return lnCount >endfunc >>
>>>>local itotal >>>>select distinct id from mytable; >>>> where between(mytable.id,1583,1927); >>>> and mytable.state=='NY' into cursor mycursor nofilter >>>>itotal=reccount('mycursor') >>>>myform.txt1.value=transform(itotal) >>>>use in mycursor>>>