do case case !empt() and empt() sele * from 表 where 某年=allt() into curs a1 case !empt() and !empt() sele * from 表 where 某年=allt() and 某月=allt() into curs a1 endc thisform.grid1.controlsource="a1"