看不到您的查询代码,只能提出如下建议:
如果您是用Set filter筛选方式,则可用Copy to导出
如果您是用Select-SQL命令,则用“Into 文件名”把查询结果存入到文件中
我的代码是:cx=0
*按货物查询
do case
SELECT fahuo
case thisform.check1.value=1
Thisform.Grid1.RecordSource="SELECT * FROM fahuo;
WHERE 货物=ALLTRIM(thisform.combo1.displayvalue);
INTO CURSOR TEMP"
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 CURSOR TEMP"
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 cursor linquery"
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 cursor linquery"
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 cursor linquery"
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 CURSOR TEMP"
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
thisform.grid1.recordsource="select *from wuyemanage!fahuo;
where between(时间,sdate,edate);
order by fahuo.时间;
into cursor linquery"
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
请问应该怎么将查询结果导出