天空海阔 发表于 2008-5-17 16:32

再次请教版主一个问题

小弟我设计一个查询表单
要将筛选符合条件的数据以表格形式显示出来
我在一本书上找到一段代码修改了一下作为command的click过程
但是运行老是在where &cxtj into cursor lscanshubiao显示
“不能识别的命令谓词”
麻烦请版主指导一下该怎么修改
private cxtj
if empty(thisform.combo1.displayvalue)or empty(thisform.combo2.displayvalue)or empty(thisform.text1.value)
    wait windows'请输入完整条件!'
thisform.combo1.setfocus
else
   do case
     case alltrim(thisform.combo1.displayvalue)='给料粒度'
      cxtj=alltrim(thisform.combo1.displayvalue)+''+alltrim(thisform.combo2.displayvalue)+''+alltrim(thisform.text1.value)
     case alltrim(thisform.combo1.displayvalue)='给料能力'
      cxtj=alltrim(thisform.combo1.displayvalue)+''+alltrim(thisform.combo2.displayvalue)+''+alltrim(thisform.text1.value)
     otherwise
      cxtj=alltrim(thisform.combo1.displayvalue)+''+alltrim(thisform.combo2.displayvalue)+'"'+alltrim(thisform.text1.value)+'"'
    endcase
    select*from canshubiao
    where &cxtj into cursor lscanshubiao
    thisform.grid1.recordsource='lscanshubiao'
    thisform.grid1.backcolor=rgb(200,224,248)
endif

wzxc 发表于 2008-5-17 20:01

cxtj=alltrim(thisform.combo1.displayvalue)+''+alltrim(thisform.combo2.displayvalue)+''+alltrim(thisform.text1.value)
这几个的运行结果是什么?

天空海阔 发表于 2008-5-17 22:35

书上是这么写的
我也不是太清楚
好像是给宏赋值吧

啸凡 发表于 2008-5-17 23:52

把select*from canshubiao
改成select*from canshubiao;(仅仅是加个分号)
明白为什么了吗?不明白的话就好好看看书。

天空海阔 发表于 2008-5-18 08:27

修改以后运行时在
select*from canshubiao;
提示"操作符/操作数类型不匹配"又是怎么回事啊

啸凡 发表于 2008-5-18 16:10

select*from改成select * from  (加空格试试)

午丁 发表于 2008-5-18 17:45

连接的结果赋值个变量

[quote][bo]以下是引用 [un]wzxc[/un] 在 2008-5-17 20:01 的发言:[/bo]

cxtj=alltrim(thisform.combo1.displayvalue)+''+alltrim(thisform.combo2.displayvalue)+''+alltrim(thisform.text1.value)
这几个的运行结果是什么? [/quote]
“alltrim”删除前后空格
“thisform.combo1.displayvalue”列表框或组合框(1)中选定项的第一列的内容
“thisform.combo1.disp2ayvalue”列表框或组合框(2)中选定项的第一列的内容
“thisform.text1.value”文本框中输入的内容
“cxtj=”连接的结果赋值个变量“cxtj”

天空海阔 发表于 2008-5-19 08:00

[quote][bo]以下是引用 [un]啸凡[/un] 在 2008-5-18 16:10 的发言:[/bo]

select*from改成select * from  (加空格试试) [/quote]
是我把combo1里的一个字段名写错了
改成和canshubiao里一样后就运行出来了
呵呵!
麻烦版主,再次表示感谢!

页: [1]

编程论坛