Foxtable(狐表)用户栏目专家坐堂 → 请问哪里有错?


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

主题:请问哪里有错?

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


加好友 发短信
等级:二尾狐 帖子:528 积分:5034 威望:0 精华:0 注册:2012/4/6 19:31:00
请问哪里有错?  发帖心情 Post By: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
怎么执行不了?谢谢!

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By: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
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:528 积分:5034 威望:0 精华:0 注册:2012/4/6 19:31:00
  发帖心情 Post By: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


加上日期又不对了。

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


加好友 发短信
等级:超级版主 帖子:107304 积分:545781 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/11/27 22:46:00 [只看该作者]

如果是SqlServer数据库,

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

 回到顶部