以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]筛选代码有问题,求助 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=64116) |
-- 作者:a1937462891 -- 发布时间:2015/2/5 11:26:00 -- [求助]筛选代码有问题,求助 我设计的筛选按钮,按照 Dim xm As WinForm.TextBox = e.Form.Controls("姓名") Dim fz As WinForm.ComboBox = e.Form.Controls("分组") Dim xyjf As WinForm.TextBox = e.Form.Controls("现有积分") Dim dw As WinForm.TextBox = e.Form.Controls("工作单位") Dim yjfx As WinForm.ComboBox = e.Form.Controls("研究方向") Dim szss As WinForm.TextBox = e.Form.Controls("所在省市") Dim fzr As WinForm.TextBox = e.Form.Controls("负责人") Tables("会员信息表").Filter="姓名 like \'*" & xm.Text & "*\' and 分组 like \'*" & fz.Text & "*\' and 现有积分 like \'*" & xyjf.Text & "*\' and 工作单位 like \'*" & dw.Text & "*\' and 研究方向 like \'*" & yjfx.Text & "*\' and 所在省市 like\'*" & szss.Text & "*\' and 负责人 Like \'*" & fzr.Text & "*\'" 点击之后,总是提示"无法将类型为“Foxtable.WinForm.ComboBox”的对象强制转换为类“Foxtable.WinForm.TextBox”。 "应该怎么修改 另外,我想在积分筛选那块,做成大于某一个值的筛选,应该怎么弄啊 我按照http://www.foxtable.com/help/index.html?n=1058.htm的帮助进行修改过,也是有问题,苦恼 [此贴子已经被作者于2015-2-5 17:25:51编辑过]
|
-- 作者:Bin -- 发布时间:2015/2/5 11:28:00 -- 你搞错了了类型. 你某个个控件是 下拉框,你当作文本框来用了 |
-- 作者:Bin -- 发布时间:2015/2/5 11:29:00 -- 而且你这样做筛选,某个控件没填写内容,就容易出错 |
-- 作者:a1937462891 -- 发布时间:2015/2/5 13:41:00 -- 已经修改了文本的问题,现在是 Dim xm As WinForm.TextBox = e.Form.Controls("姓名") Dim fz As WinForm.ComboBox = e.Form.Controls("分组") Dim xyjf As WinForm.TextBox = e.Form.Controls("现有积分") Dim dw As WinForm.TextBox = e.Form.Controls("工作单位") Dim yjfx As WinForm.ComboBox = e.Form.Controls("研究方向") Dim szss As WinForm.TextBox = e.Form.Controls("所在省市") Dim fzr As WinForm.ComboBox = e.Form.Controls("负责人") Tables("会员信息表").Filter="姓名 like \'*" & xm.Text & "*\' and 分组 like \'*" & fz.Text & "*\' and 现有积分 like \'*" & xyjf.Text & "*\' and 工作单位 like \'*" & dw.Text & "*\' and 研究方向 like \'*" & yjfx.Text & "*\' and 所在省市 like\'*" & szss.Text & "*\' and 负责人 Like \'*" & fzr.Text & "*\'" 现在提示”无法在 System.Int32 和 System.String 上执行“Like”操作。“ 现有积分那块,我想实现对某一区间段的筛选,实在不知道对数值是怎么判断的,编程零基础......
[此贴子已经被作者于2015-2-5 17:26:07编辑过]
|
-- 作者:Bin -- 发布时间:2015/2/5 13:59:00 -- 看3楼. |
-- 作者:a1937462891 -- 发布时间:2015/2/5 15:26:00 -- 谢了,经过反复揣摩,终于修改了比较好的结果,但是还有点问题,对”现有积分”那块的筛选,提示“该字符串未被识别为有效的 DateTime。”,用的textbox啊 代码如下:
Dim Filter As String With e.Form.Controls("xm") If .Value IsNot Nothing Then Filter = "姓名 Like \'*" & .Value & "*\'" End If End With With e.Form.Controls("fz") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "分组 = \'" & .Value & "\'" End If End With With e.Form.Controls("gzdw") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "工作单位 Like \'*" & .Value & "*\'" End If End With With e.Form.Controls("yjfx") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "研究方向 Like \'*" & .Value & "*\'" End If End With With e.Form.Controls("szss") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "所在省市 Like \'*" & .Value & "*\'" End If End With With e.Form.Controls("fzr") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "负责人 Like \'*" & .Value & "*\'" End If End With With e.Form.Controls("xyjf1") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "现有积分 >= #" & .Value & "#" End If End With With e.Form.Controls("xyjf2") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "现有积分 <= #" & .Value & "#" End If End With With e.Form.Controls("hyyxq1") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "会员有效期 >= #" & .Value & "#" End If End With With e.Form.Controls("hyyxq2") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "会员有效期 <= #" & .Value & "#" End If End With With e.Form.Controls("zsyxq1") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "证书有效期 >= #" & .Value & "#" End If End With With e.Form.Controls("zsyxq2") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "证书有效期 <= #" & .Value & "#" End If End With If Filter > "" Then Tables("会员信息表").Filter = Filter End If [此贴子已经被作者于2015-2-5 17:26:25编辑过]
|
-- 作者:Bin -- 发布时间:2015/2/5 15:28:00 -- 日期就用日期框. 如果不是日期格式,就不要用#号. 用单引号 |
-- 作者:a1937462891 -- 发布时间:2015/2/5 15:34:00 -- 太感谢了,终于把筛选的事情弄顺了,对于零基础的新人,而且还被催的很急的情况下,版主帮大忙了 |