>Thanks Neil,
>
>I have created the Method and you code works fine. Due to me being a novice with Foxpro how can I adapt this into my code below:
>
>
>SET EXCLUSIVE off
>SET DELETED ON
>SET DEFAULT TO U:\Data
>USE modacad
>SELECT modacad
>
>LOCAL lctotal, lcsample, lctechnical, lcseason, lcdept, lcdesigner
>
>IF thisform.combo1.DisplayValue = 'ALL'
> lcseason = ' and ' + 'modacad.key1=""'
> ELSE
> lcseason = ' and ' + 'modacad.key1=thisform.combo1.DisplayValue'
>ENDIF
>
>IF thisform.combo2.DisplayValue = 'ALL'
> lcdept = ' and ' + 'modacad.key2=""'
> ELSE
> lcdept = ' and ' + 'modacad.key2=thisform.combo2.DisplayValue'
>ENDIF
>
>IF thisform.combo3.DisplayValue = 'ALL'
> lcdesigner = ' and ' + 'modacad.moc014=""'
> ELSE
> lcdesigner = ' and ' + 'modacad.moc014=thisform.combo3.DisplayValue'
>ENDIF
>
>COUNT FOR modacad.key4='SAMPLE' &lcseason &lcdept &lcdesigner TO lcsample
>COUNT FOR modacad.key4='TECHNICAL' &lcseason &lcdept &lcdesigner TO lctechnical
>COUNT FOR modacad.key4<>'ZZZZ' &lcseason &lcdept &lcdesigner TO lctotal
>
>thisform.text1.Value = lcsample
>thisform.text2.Value = lctechnical
>thisform.text3.Value = lctotal
>thisform.text4.Value = lctotal - (lcsample + lctechnical)
>
>
>Many Thanks
Neil,
You're saying it's taking time and doing it 3 times when one is enough ?
set talk on
select ;
sum(iif(key4='SAMPLE',1,0)) as TotSample, ;
sum(iif(key4='TECHNICAL',1,0)) as TotTech, ;
sum(iif(key4#'ZZZZ',1,0)) as Total ;
from myTable ;
where .t. &lcseason &lcdept &lcdesigner ;
into array arrTotals
set talk off
thisform.text1.Value = arrTotals[1]
thisform.text2.Value = arrTotals[2]
thisform.text3.Value = arrTotals[3]
thisform.text4.Value = arrTotals[3] - (arrTotals[1] + arrTotals[2])
Cetin