以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 查询按钮公式  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=68265)

--  作者:wumingrong1
--  发布时间:2015/5/13 17:25:00
--  [求助] 查询按钮公式
我的查询按钮公式如下:

vars("查询") = True
Dim flt As String
For Each c As Col In Tables("抢修整治迁改表").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 & " = #" & 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("抢修整治迁改表").Filter = flt
vars("查询") = False


我的查询窗口如下:为什么我选择【查看是否超时】和【处理是否超时】两个控件为False时;查询按钮公式没有生效


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


--  作者:大红袍
--  发布时间:2015/5/13 17:33:00
--  

1、名称要和列一致

 

2、

 

For Each c As Col In Tables("抢修整治迁改表").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 & " = #" & e.Form.Controls(ctl.Name).Text & "#"
                ElseIf c.IsString Then
                    flt + = " And " & c.Name & " Like \'%" & e.Form.Controls(ctl.Name).Text & "%\'"
                ElseIf c.IsBoolean AndAlso e.Form.Controls(ctl.Name).Check Then
                    msgbox(c.Name)
                    flt + = " And " & c.Name & " = " & e.Form.Controls(ctl.Name).Checked
                End If

            End If
        End If
    Next
Next