Foxtable(狐表)用户栏目专家坐堂 → 组合查询


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

主题:组合查询

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


加好友 发短信
等级:八尾狐 帖子:1995 积分:12684 威望:0 精华:0 注册:2017/4/3 15:01:00
组合查询  发帖心情 Post By:2017/8/12 20:58:00 [显示全部帖子]

Dim Filter As String=""
Dim khmcmhcz As WinForm.CheckBox = e.Form.Controls("kuhumohuchaxunCheckBox")
With e.Form.Controls("kehuxingmingTextBox2")
    If .Value IsNot Nothing Then
        If khmcmhcz.Checked Then
            Filter &= "客户姓名 like '%" & .Value  & "%'"
        Else
            Filter &= "客户姓名= '" & .Value & "'"
        End If
    End If
End With
Dim sfzhmhcz As WinForm.CheckBox = e.Form.Controls("shenfenzhengmohuchaxunCheckBox")
With e.Form.Controls("shenfenzhenghaoTextBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        If sfzhmhcz.Checked Then
            Filter &= "身份证号 Like '%" & .Value  & "%'"
        Else
            Filter &= "身份证号= '" & .Value & "'"
        End If
    End If
End With
With e.Form.Controls("kehuxingbieComboBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter &= "性别= '" & .Value & "'"
    End If
End With
Dim sjmhcz As WinForm.CheckBox = e.Form.Controls("shoujimohuchaxunCheckBox")
With e.Form.Controls("shoujihaoTextBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        If sjmhcz.Checked Then
            Filter &="客户主手机号 like '%" & .Value   & "%' Or 第二手机号 like '%" & .Value   & "%' Or  第三手机号 Like '%" & .Value   & "%'"
        Else
            Filter &= "客户主手机号 = '" & .Value & "' Or 第二手机号= '" & .Value & "' Or 第三手机号 = '" & .Value & "'"
        End If
    End If
End With
Dim dzmhcz As WinForm.CheckBox = e.Form.Controls("dizhimohuchaxunCheckBox")
With e.Form.Controls("kehudizhiTextBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        If dzmhcz.Checked Then
            Filter &= "客户地址 like '%" & .Value  & "%'"
        Else
            Filter &= "客户地址= '" & .Value & "'"
        End If
    End If
End With
With e.Form.Controls("kehuleibieComboBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter &= "客户类别= '" & .Value & "'"
    End If
End With
If Filter > "" Then
    Tables("客户资料").Filter = Filter
End If

 

这段代码哪错了运行后(我是手机号是模糊查询、再加上性别)性别怎么不筛选呀

 

 

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:客户入库程序.table


图片点击可在新窗口打开查看此主题相关图片如下:4566666.png
图片点击可在新窗口打开查看

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


加好友 发短信
等级:八尾狐 帖子:1995 积分:12684 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/8/13 14:04:00 [显示全部帖子]

这个是组合查询

就这几句代码吗?

看懂了

[此贴子已经被作者于2017/8/13 14:06:52编辑过]

 回到顶部