>>>SELECT p* FROM allcounts >>>>>>
>>nFcount=fcount('allcounts') >>cFieldstring='' >>For nLoop=1 to nFcount >> If Upper(Left(field(nLoop,'allcounts'),1))=='P' >> cFieldstring=cFieldstring+" + " + field(nLoop,'allcounts') >> Endif >>Endfor >>If Empty(cFieldstring) >> =messagebox("No Qualified Fields Found!") >> Return >>Endif >>cFieldstring=left(cFieldstring,len(cFieldstring)-1) >>SELECT &cFieldstring. FROM allcounts >>>
>procedure GetD1Total > lparameters iCountID,iDay > cFields = "" > for i = 1 to 96 > cFields = cFields + "p" + alltrim(str(i)) + "," > next > cFields = left(cFields, len(cFields)-1) > > select &cFields from allcounts where count_id = iCountID and _day = iDay into array A1 > RetVal = 0 > for i = 1 to 96 > RetVal = RetVal + A1(i) > next > close tables all > return RetVal >May be you could have created one field as