InteractiveChange事件:当用户用键盘或鼠标改变对象的值时发生。
set filter to 后接逻辑表达式
例:
c_zd=alltrim(thisform.combo1.value)c_val=alltrim(thisform.text1.value)
set filter to &c_zd>=c_val &&text1框作为字符型
set filter to &c_zd>=CTOD(c_val) &&text1框作为日期型
set filter to &c_zd>=VAL(c_val) &&text1框作为数值型
set filter to &c_zd>=&c_val &&text1框作为逻辑型
注意以上c_zd均使用&进行引用,类似于sql语句中的引用
灵活使用sql的两种正确方法及一种错误方法
thisform.grid1.RecordSourceType = 4
thisform.grid1.RecordSource = "select * from 视图3 where " + thisform.combo1.Value + " = a into cursor temp" &&方法1为拼接sql语句
search_tiaojian = thisform.combo1.Value &&方法2为在sql语句中使用引用
thisform.grid1.RecordSource = "select * from 视图3 where &search_tiaojian = a into cursor temp"
thisform.grid1.RecordSource = "select * from 视图3 where thisform.combo1.Value = a into cursor temp" &&直接使用,行不通
thisform.label2.Caption = temp.姓名 thisform.label3.Caption = thisform.Combo1.value
下面改变库的两种方式结果并不一样,方法一所有“列”字段为同一值,因为t只传递了一次,方法二为变值
t=mod(VAL(SUBSTR(ALLTRIM(准考证号),6,4)),30)
UPDATE zct SET 列=t WHERE mod(VAL(SUBSTR(ALLTRIM(准考证号),6,4)),30)>0 &&方法一
UPDATE zct SET 列=mod(VAL(SUBSTR(ALLTRIM(准考证号),6,4)),30) WHERE mod(VAL(SUBSTR(ALLTRIM(准考证号),6,4)),30)>0 &&方法二