先谢谢各位啦!不过我真是很郁闷了,我先把我的完整代码给大家看下吧
cx=0
*按货物查询
do case
SELECT fahuo
case thisform.check1.value=1
Thisform.Grid1.RecordSource="SELECT * FROM fahuo;
WHERE 货物=ALLTRIM(thisform.combo1.displayvalue);
Into Table C:\临时表"
Thisform.Refresh
ENDCASE
*按经销商查询
do case
case thisform.check3.value=1
ctext=alltrim(thisform.text1.value)
if empty(ctext)
messagebox('请输入查询条件!',48,'操作失败!')
thisform.text1.setfocus
else
Thisform.Grid1.RecordSource="SELECT * FROM fahuo;
WHERE 经销商=ALLTRIM(Thisform.Text1.value);
Into Table C:\临时表"
ENDif
endcase
*按经销商,时间和货物查询
SELECT fahuo
do case
case thisform.check1.value=1 and thisform.check2.value=1 and thisform.check3.value=1
ctext=alltrim(thisform.text1.value)
sdate=thisform.text2.value
edate=thisform.text3.value
ctext=alltrim(thisform.text1.value)
if empty(ctext)
messagebox('请输入查询条件!',48,'操作失败!')
thisform.text1.setfocus
else
if empty(sdate)
messagebox('请输入起始时间!',48,'操作失败!')
thisform.text2.setfocus
else
if empty(edate)
messagebox('请输入结束时间!',48,'操作失败!')
thisform.text3.setfocus
else
thisform.grid1.recordsource="select *from wuyemanage!fahuo;
where between(时间,sdate,edate) and 货物=ALLTRIM(thisform.combo1.displayvalue) and 经销商=ALLTRIM(Thisform.Text1.value);
order by fahuo.时间;
Into Table C:\临时表"
Thisform.Refresh
ENDIF
ENDIF
ENDIF
*按货物和经销商查询
case thisform.check1.value=1 and thisform.check3.value=1
ctext=alltrim(thisform.text1.value)
if empty(ctext)
messagebox('请输入查询条件!',48,'操作失败!')
thisform.text1.setfocus
else
thisform.grid1.recordsource="select *from wuyemanage!fahuo;
where 经销商=ALLTRIM(Thisform.Text1.value) and 货物=ALLTRIM(thisform.combo1.displayvalue);
order by fahuo.时间;
Into Table C:\临时表"
Thisform.Refresh
go top
if eof()
go bottom
messagebox('无此记录!',48,'信息窗口')
cx=1
endif
ENDIF
*按货物和时间查询
case thisform.check1.value=1 and thisform.check2.value=1
sdate=thisform.text2.value
edate=thisform.text3.value
if empty(sdate)
messagebox('请输入起始时间!',48,'操作失败!')
thisform.text2.setfocus
else
if empty(edate)
messagebox('请输入结束时间!',48,'操作失败!')
thisform.text3.setfocus
else
thisform.grid1.recordsource="select *from wuyemanage!fahuo;
where between(时间,sdate,edate) and 货物=ALLTRIM(thisform.combo1.displayvalue);
order by fahuo.时间;
Into Table C:\临时表"
Thisform.Refresh
ENDIF
ENDIF
*按经销商和日期查询
case thisform.check3.value=1 and thisform.check2.value=1
sdate=thisform.text2.value
edate=thisform.text3.value
ctext=alltrim(thisform.text1.value)
if empty(sdate)
messagebox('请输入起始时间!',48,'操作失败!')
thisform.text2.setfocus
else
if empty(edate)
messagebox('请输入结束时间!',48,'操作失败!')
thisform.text3.setfocus
else
if empty(ctext)
messagebox('请输入查询条件!',48,'操作失败!')
thisform.text1.setfocus
else
Thisform.Grid1.RecordSource="SELECT * FROM fahuo;
WHERE 经销商=ALLTRIM(Thisform.Text1.value) and between(时间,sdate,edate);
Into Table C:\临时表"
ENDif
endif
endif
*按日期查询
case thisform.check2.value=1
sdate=thisform.text2.value
edate=thisform.text3.value
if empty(sdate)
messagebox('请输入起始时间!',48,'操作失败!')
thisform.text2.setfocus
else
if empty(edate)
messagebox('请输入结束时间!',48,'操作失败!')
thisform.text3.setfocus
else
SET FILTER TO BETWEEN(时间,SDATE,EDATE)
go top
if eof()
go bottom
messagebox('无此记录!',48,'信息窗口')
cx=1
endif
endif
endif
case thisform.check1.value=0 and thisform.check2.value=0 and thisform.check3.value=0
messagebox('请选择查询条件!',48,'操作失败!')
thisform.check1.setfocus
endcase
我发现只要我把时间这个字段改成日期型的,我仅按时间查询时就没的任何反应,但是如果是按货物和时间查询显示的结果又是对的,到底怎么办呀,我现在搞的一头雾水的!