Foxtable(狐表)用户栏目专家坐堂 → [求助]筛选按钮代码


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

主题:[求助]筛选按钮代码

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


加好友 发短信
等级:幼狐 帖子:113 积分:731 威望:0 精华:1 注册:2011/8/16 14:13:00
  发帖心情 Post By:2011/9/10 11:07:00 [显示全部帖子]

Dim dr As DataRow
Dim Filter As String '设置变量Filter,返回或设置过滤条件表达式
With e.Form.Controls("combobox1") '筛选单位,Controls引用窗口中名为cmbProduct组合框数据
    If .Value IsNot Nothing Then '如果cmbProduct框不为空,则执行下面的语句
        dr = DataTables("表A").Find("姓名 = '" & .Value & "'","[_Identify] Desc")
        If dr IsNot Nothing Then
            Filter = "[_Identify]= " & dr("_Identify")   '在本表中的单位中查找
        End If
        
        If Filter > "" Then   '如果筛选条件为空
            Tables("表A").Filter = Filter   '则不筛选
        End If
    End If
End With

 回到顶部