以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  请问哪里有错?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=127945)

--  作者:kmzb56
--  发布时间:2018/11/25 22:51:00
--  请问哪里有错?
With e.Form.Controls("TextBox1")
If .value IsNot Nothing Then
     Filter="收入 =.Value "
    End If
End With


With e.Form.Controls("TextBox2")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "支出 =.Value "
    End If
End With
With e.Form.Controls("TextBox3")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "余额=.Value "
    End If
End With
With e.Form.Controls("TextBox4")
    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("TextBox5") 
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "经手人 Like  \'*" & .Value & "*\'"
    End If
End With

If Filter > "" Then
    Tables("收付款帐户_Table1").Filter = Filter
怎么执行不了?谢谢!

--  作者:有点甜
--  发布时间:2018/11/25 23:11:00
--  


With e.Form.Controls("TextBox1")
If .value IsNot Nothing Then
     Filter="收入= \'" & .Value & "\'"
    End If
End With

 


With e.Form.Controls("TextBox2")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "支出 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("TextBox3")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "余额 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("TextBox4")
    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("TextBox5")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "经手人 Like  \'%" & .Value & "%\'"
    End If
End With


If Filter > "" Then
    Tables("收付款帐户_Table1").Filter = Filter
End If


--  作者:kmzb56
--  发布时间:2018/11/27 21:56:00
--  
Dim Filter As String
With e.Form.Controls("DateTimePicker1")
If .value IsNot Nothing Then
     Filter="日期 = #" & .Value & "#"
    End If
End With
 With e.Form.Controls("TextBox1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "收入 = \'" & .Value & "\'"
    End If
End With

 With e.Form.Controls("TextBox2")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "支出 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("TextBox3")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "余额 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("TextBox4")
    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("TextBox5") 
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "经手人 Like  \'%" & .Value & "%\'"
    End If
End With


If Filter > "" Then
    Tables("收付款帐户_Table1").Filter = Filter
End If


加上日期又不对了。

--  作者:有点蓝
--  发布时间:2018/11/27 22:46:00
--  
如果是SqlServer数据库,

Filter="日期 = #" & .Value & "#"
改为
Filter="日期 = \'" & .Value & "\'"