Foxtable(狐表)用户栏目专家坐堂 → 查询中加入模糊查询


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

主题:查询中加入模糊查询

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


加好友 发短信
等级:小狐 帖子:346 积分:2645 威望:0 精华:0 注册:2018/11/11 15:52:00
查询中加入模糊查询  发帖心情 Post By:2018/12/26 14:41:00 [只看该作者]

Dim Filter As String = ""
With e.Form.Controls("仓库")
    If .Value IsNot Nothing AndAlso .value <> "仓库" Then
        Filter = "仓库= '" & .Value & "'"
    End If
End With
With e.Form.Controls("车船号")
    If .Value IsNot Nothing AndAlso .value <> "车船号" Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "车船号 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("品种")
    If .Value IsNot Nothing AndAlso .value <> "品种" Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "品种 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("规格")
    If .Value IsNot Nothing AndAlso .value <> "规格" Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "规格 = '" & .Value & "'"
    End If
End With

 

With e.Form.Controls("钢种")
    If .Value IsNot Nothing AndAlso .value <> "钢种" Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "钢种 = '" & .Value & "'"
    End If
End With


With e.Form.Controls("原始提单信息")
    If .Value IsNot Nothing AndAlso .value <> "原始提单信息" Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = "原始提单信息 Like  '%" & .Value & "%'"
    End If
End With

With e.Form.Controls("提货车号")
    If .Value IsNot Nothing AndAlso .value <> "提货车号" Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = "提货车号 Like  '%" & .Value & "%'"
    End If
End With
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "出库时间 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "出库时间 <= #" & .Value & "#"
    End If
End With

If Filter > "" Then
    Tables("仓库出库明细").Filter = Filter
End If

 

提货车号和原始提单信息加入模糊查询后,其他的就不能查询了,请问要怎样修改。


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


加好友 发短信
等级:小狐 帖子:346 积分:2645 威望:0 精华:0 注册:2018/11/11 15:52:00
  发帖心情 Post By:2018/12/26 15:23:00 [只看该作者]

不能多条件一起查询


 回到顶部
帅哥哟,离线,有人找我吗?
青丘狐
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:346 积分:2645 威望:0 精华:0 注册:2018/11/11 15:52:00
  发帖心情 Post By:2018/12/26 15:43:00 [只看该作者]

品种 钢种 规格 车船号 可以多选查询,加入提货车号,原始提单信息就不能多选查询了,提货车号,原始提单信息想用模糊查询。
[此贴子已经被作者于2018/12/26 15:44:38编辑过]

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/12/26 20:32:00 [只看该作者]

Filter = "原始提单信息 Like  '%" & .Value & "%'"

 

改成

 

Filter = filter & "原始提单信息 Like  '%" & .Value & "%'"

 

----------------

 

Filter = "提货车号 Like  '%" & .Value & "%'"

 

改成

 

Filter = filter & "提货车号 Like  '%" & .Value & "%'"


 回到顶部