Foxtable(狐表)用户栏目专家坐堂 → 怎么设置按纽代码


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

主题:怎么设置按纽代码

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


加好友 发短信 好心情 一级勋章
等级:超级版主 帖子:715 积分:5564 威望:0 精华:1 注册:2008/8/31 20:45:00
  发帖心情 Post By:2008/12/16 14:24:00 [显示全部帖子]

一个例子

本课的示例文件为CaseStudy目录下的“窗口筛选.table”。

Foxtable本身的筛选功能已经非常强大,不过如果自己设计一个筛选窗口,用起来也许更顺手。
本课的目的就是设计一个下图所示的筛选窗口:

图片点击可在新窗口打开查看

设计步骤

1、插入一个组合框,改名为“cmbProduct”,列表项目设为“PD01|PD02|PD03|PD04|PD05”,用于输入要筛选的产品。
2、插入一个组合框,改名为“cmbCustomer”,列表项目设为“CS01|CS02|CS03|CS04|CS05”,用于输入要筛选的客户。
3、插入一个组合框,改名为“cmbEmployee”,列表项目设为“EP01|EP02|EP03|EP04|EP05”,用于输入要筛选的雇员。
4、插入一个日期输入框,改为名“StartDate”,用于输入开始日期。
5、插入一个日期输入框,改为名“EndDate”,用于输入结束日期。
6、插入三个按钮,标题和Click事件代码按下表所示设置。

标题 Click事件代码
清除条件 e.Form.Controls("cmbProduct").Value = Nothing
e.Form.Controls(
"cmbCustomer").Value = Nothing
e.Form.Controls(
"cmbEmployee").Value = Nothing
e.Form.Controls(
"StartDate").Value = Nothing
e.Form.Controls(
"EndDate").Value = Nothing
撤销筛选 Tables("订单").ApplyFilter = False
开始筛选 Dim Filter As String
With
e.Form.Controls("cmbProduct")
    If
.Value IsNot Nothing Then
        Filter =
"产品 = '" & .Value & "'"
   
End If
End
With
With
e.Form.Controls("cmbCustomer")
    If
.Value IsNot Nothing Then
        If
Filter > "" Then
            Filter = Filter &
" And "
   
    End If
        Filter = Filter &
"客户 = '" & .Value & "'"
   
End If
End
With
With
e.Form.Controls("cmbEmployee")
    If
.Value IsNot Nothing Then
        If
Filter >"" Then
            Filter = Filter &
" And "
       
End If
        Filter = Filter &
"雇员 = '" & .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

7、窗口类型设为独立,自动打开属性设为True。

设计中的窗口:

图片点击可在新窗口打开查看

 



查看使用道具详细信息
悬赏金币帖,要悬赏 0 个金币
 回到顶部