以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 查询公式排除某个控件  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=59108)

--  作者:wumingrong1
--  发布时间:2014/10/29 18:58:00
--  [求助] 查询公式排除某个控件
我有一个查询按钮,想实现两种组合情况下的查询;

但当我在“宽带帐号”中录入查询内容并点击查询按钮时。弹出错误提示、是不是红色部分命令有问题?该怎么改?



图片点击可在新窗口打开查看此主题相关图片如下:360截图20141029185852734.jpg
图片点击可在新窗口打开查看


If e.Form.Controls("宽带帐号") > " " Then

Tables("OLT设备用户端口数据表").Filter = "宽带帐号 = \'" & e.Form.Controls("宽带帐号") & "\' or 电话号码 = \'" & e.Form.Controls("宽带帐号") & "\' "

Else 

Dim flt As String
For Each c As Col In Tables("OLT设备用户端口数据表").Cols
For Each ctl As WinForm.Control In e.Form.Controls
If c.Name = ctl.Name Then
If e.Form.Controls(ctl.Name).Text > "" Then
If c.IsDate Then
flt + = " And " & c.Name & " like #" & e.Form.Controls(ctl.Name).Text & "#"
ElseIf c.IsString Then
flt + = " And " & c.Name & " Like \'%" & e.Form.Controls(ctl.Name).Text & "%\'"
End If
End If
End If
Next
Next
If flt > "" Then
flt = flt.SubString(5)
Else
MessageBox.Show("请输入查询条件")
End If
Tables("OLT设备用户端口数据表").Filter = flt

End If

--  作者:有点甜
--  发布时间:2014/10/29 19:01:00
--  
e.Form.Controls("宽带帐号").Text