[求助]关于查询中表格的使用问题?
我建立了一个查询表单,其中Optiongroup1是表示选择不同的车间的,combo1表示选者不同的查询字段,我用下面的程序,对于相同的查询只能查询一次,再运行一次以后就会显示程序错误:同名的程序对象已经存在!请高手指点应该如何改进!if thisform.Optiongroup1.value=1
set talk off
close all
use c:\检修车间设备台帐.dbf
IF NOT Empty(ThisForm.text1.value)
if ThisForm.combo1.value="设备序号"
Select 设备序号,设备名称,设备型号,设备编号,设备状态,设备原值(元);
from c:\检修车间设备台帐.dbf;
where 检修车间设备台帐.设备序号=ThisForm.text1.value into table mycursor1
select mycursor1 &&mycursor为查询结果临时表,由SQL语句生成
go top
thisform.addobject('grid1','grid')
thisform.grid1.refresh
thisform.grid1.visible=.t.
thisform.grid1.left=150
thisform.grid1.top=100
thisform.grid1.width=546
thisform.grid1.height=268
thisform.grid1.deletemark=.F.
thisform.show
endif
if ThisForm.combo1.value="设备编号"
Select 设备序号,设备名称,设备型号,设备编号,设备状态,设备原值(元);
from c:\检修车间设备台帐.dbf;
where 检修车间设备台帐.设备编号=ThisForm.text1.value into table mycursor2
select mycursor2 &&mycursor为查询结果临时表,由SQL语句生成
go top
thisform.addobject('grid2','grid')
thisform.grid2.refresh
thisform.grid2.visible=.t.
thisform.grid2.left=150
thisform.grid2.top=100
thisform.grid2.width=546
thisform.grid2.height=268
thisform.grid2.deletemark=.F.
thisform.show
endif
if ThisForm.combo1.value="设备名称"
Select 设备序号,设备名称,设备型号,设备编号,设备状态,设备原值(元);
from c:\检修车间设备台帐.dbf;
where 检修车间设备台帐.设备名称=ThisForm.text1.value into table mycursor3
select mycursor3 &&mycursor为查询结果临时表,由SQL语句生成
go top
thisform.addobject('grid3','grid')
thisform.grid3.refresh
thisform.grid3.visible=.t.
thisform.grid3.left=150
thisform.grid3.top=100
thisform.grid3.width=546
thisform.grid3.height=268
thisform.grid3.deletemark=.F.
thisform.show
endif
endif
endif