Foxtable(狐表)用户栏目专家坐堂 → 模糊查找


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

主题:模糊查找

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/8/13 15:45:00 [显示全部帖子]


Dim aa As WinForm.TextBox  = e.Form.Controls("TextBox3")
Dim Filter As String
Dim str As String
Dim Ast() As String  = {"订车单位","派车单位"}
For Each a As String In Ast
    If str > "" Then
        str  = str & " Or "
    End If
    str = str  & "[" & a & "] Like '%" & aa.value & "%'"
Next
If str > "" Then
    filter = "(" & str & ")"
End If
With e.Form.Controls("TextBox3")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter &  "[订车单位] Like '%" & .Value & "%'" And "[派车单位] Like '%" & .Value & "%'"
    End If
End With
With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "实际用车日期_起 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("DateTimePicker2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "实际用车日期_起 <= #" & .Value & "#"
    End If
End With
If e.Form.Controls("已付款").Checked = True ' 如果付款状态选择了"已付"
    If Filter > "" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "派车单位结算_租金结算  = True"
End If
If e.Form.Controls("未付款").Checked = True ' 如果付款状态选择了"未付"
    If Filter > "" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "(派车单位结算_租金结算 = False Or 派车单位结算_租金结算 Is Null)"
End If
If Filter > "" Then
    Tables("用车明细表").Filter = Filter
End If


 回到顶部