Foxtable(狐表)用户栏目专家坐堂 → [求助]初学者求个代码!!!


  共有1752人关注过本帖树形打印复制链接

主题:[求助]初学者求个代码!!!

帅哥哟,离线,有人找我吗?
ryanlee
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:3 积分:86 威望:0 精华:0 注册:2016/3/7 19:21:00
[求助]初学者求个代码!!!  发帖心情 Post By:2016/3/7 19:41:00 [只看该作者]

在foxtable的帮助中,教了我大概应如何设计一个查询窗口。参考网页http://www.foxtable.com/help/index.html?n=1058.htm

如下图:
图片点击可在新窗口打开查看

但教程示例中使用的都是组合框作为输入筛选条件的控件,我需要一个能用文本框输入筛选条件的。

我添加了文本框并沿用了教程中的代码:

Dim Filter As String
With
e.Form.Controls("cmbProduct")
If .Value IsNot Nothing Then
Filter =
"产品 = '" & .Value & "'"
End If
End
With
With
e.Form.Controls("cmbCustomer")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter &
" And "
End If
Filter = Filter &
"客户 = '" & .Value & "'"
End If
End
With
With
e.Form.Controls("cmbEmployee")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter &
" And "
End If
Filter = Filter &
"雇员 = '" & .Value & "'"
End If
End
With


!!!!我的问题来了!!!
用以上的代码做成查询窗口后,使用时必须输入和数据表中完全相同的文字才能筛选出来该列。

我特别想知道,什么样的代码才能让我在查询窗口的文本框中输入“包含的关键字 ”就可以筛选出该列

拜托了,帮我编写一下吧,要把下面这样的代码改成什么样子才行啊。
Dim Filter As String
With
 e.Form.Controls("cmbProduct")
If .Value IsNot Nothing Then
Filter = 
"产品 = '" & .Value & "'"
End If
End
 With
With
 e.Form.Controls("cmbCustomer")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & 
" And "
End If
Filter = Filter & 
"客户 = '" & .Value & "'"
End If
End
 With
With
 e.Form.Controls("cmbEmployee")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & 
" And "
End If
Filter = Filter & 
"雇员 = '" & .Value & "'"
End If
End
 With


 回到顶部
帅哥哟,离线,有人找我吗?
fjlclxj
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:321 积分:2468 威望:0 精华:2 注册:2013/1/16 19:33:00
  发帖心情 Post By:2016/3/7 19:54:00 [只看该作者]

Filter = Filter & "雇员 like '%" & .Value & "%'"
[此贴子已经被作者于2016/3/7 19:53:52编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
ryanlee
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:3 积分:86 威望:0 精华:0 注册:2016/3/7 19:21:00
  发帖心情 Post By:2016/3/7 23:28:00 [只看该作者]

灰常感谢 ,在历史的帖子中找到了答案,也感谢这位英雄图片点击可在新窗口打开查看

 回到顶部