Foxtable(狐表)用户栏目专家坐堂 → 关于日期列的年份筛选


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

主题:关于日期列的年份筛选

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


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
关于日期列的年份筛选  发帖心情 Post By:2016/7/28 17:53:00 [只看该作者]

Dim cj As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim dm As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim hm As WinForm.ComboBox = e.Form.Controls("ComboBox3")
If cj.SelectedItem IsNot Nothing Then
    If dm.SelectedItem IsNot Nothing Then
        If hm.SelectedItem IsNot Nothing Then
            e.sender.ComboList = DataTables("开piao主表").GetComboListString(Year(开piao日期) ,"客户名称 = '"& cj.text &"'and fa piao代码 = '"& dm.text &"'and fa piao号码 = '"& hm.text &"'","_identify")
        Else
            e.sender.ComboList = DataTables("开piao主表").GetComboListString(Year(开piao日期)  ,"客户名称 = '"& cj.text &"'and fa piao代码 = '"& dm.text &"'","_identify")
        End If
    Else
        If hm.SelectedItem IsNot Nothing Then
            e.sender.ComboList = DataTables("开piao主表").GetComboListString(Year(开piao日期) ,"客户名称 = '"& cj.text &"'and fa piao号码 = '"& hm.text &"'","_identify")
        Else
            e.sender.ComboList = DataTables("开piao主表").GetComboListString(Year(开piao日期)  ,"客户名称 = '"& cj.text &"'","_identify")
        End If
    End If
Else
    If dm.SelectedItem IsNot Nothing Then
        If hm.SelectedItem IsNot Nothing Then
            e.sender.ComboList = DataTables("开piao主表").GetComboListString(Year(开piao日期) ," fa piao代码 = '"& dm.text &"'and fa piao号码 = '"& hm.text &"'","_identify")
        Else
            e.sender.ComboList = DataTables("开piao主表").GetComboListString(Year(开piao日期)  ," fa piao代码 = '"& dm.text &"'","_identify")
        End If
    Else
        If hm.SelectedItem IsNot Nothing Then
            e.sender.ComboList = DataTables("开piao主表").GetComboListString(Year(开piao日期) ," fa piao号码 = '"& dm.text &"'","_identify")
        Else
            e.sender.ComboList = DataTables("开piao主表").GetComboListString(Year(开piao日期)  ,"","_identify")
        End If
    End If
End If

 

帮我改一下吧,Year(开piao日期) 有问题,出现错误:


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

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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/7/28 18:05:00 [只看该作者]

不能这样用的。增加一个表达式列记录开piao日期的年份


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


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
  发帖心情 Post By:2016/7/28 21:01:00 [只看该作者]

晕,这句代码不会写,不知道怎么加上去


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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/7/29 9:30:00 [只看该作者]

创建一个表达式列,表达式填:SubString(Convert([开piao日期],'System.String'),1,4)



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


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
  发帖心情 Post By:2016/7/29 11:30:00 [只看该作者]

Dim cj As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim dm As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim hm As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim kpn As WinForm.ComboBox = e.Form.Controls("ComboBox4")
If cj.text IsNot Nothing
    If dm.text IsNot Nothing
        If hm.text IsNot Nothing
        Tables("开piao主表").Filter = "年 = '" & kpn.Text & "'and fa piao号码 = '" & hm.Text & "'and fa piao代码 like '%" & dm.Text & "%'and 客户名称 like '%" & cj.Text & "%'"
        Else
        Tables("开piao主表").Filter = "年 = '" & kpn.Text & "'and fa piao代码 = '" & dm.Text & "'and 客户名称 like '%" & cj.Text & "%'"
        End If
    Else
        If hm.text IsNot Nothing
        Tables("开piao主表").Filter = "年 = '" & kpn.Text & "'and fa piao号码 = '" & hm.Text & "'and 客户名称 like '%" & cj.Text & "%'"
        Else
        Tables("开piao主表").Filter = "年 = '" & kpn.Text & "'and 客户名称 like '%" & cj.Text & "%'"
        End If
   End If
Else
    If dm.text IsNot Nothing
        If hm.text IsNot Nothing
        Tables("开piao主表").Filter = "年 = '" & kpn.Text & "'and fa piao号码 = '" & hm.Text & "'and fa piao代码 like '%" & dm.Text & "%'"
        Else
        Tables("开piao主表").Filter = "年 = '" & kpn.Text & "'and fa piao代码 = '" & dm.Text & "'"
        End If
    Else
        If hm.text IsNot Nothing
        Tables("开piao主表").Filter = "年 = '" & kpn.Text & "'and fa piao号码 = '" & hm.Text & "'"
        Else
        Tables("开piao主表").Filter = "年 = '" & kpn.Text & "'"
        End If
   End If
End If

 

用了表达式,这筛选怎么就没反应了呢?


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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/7/29 12:30:00 [只看该作者]

调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm

text的判断都改成类似下面

If 控件.text > "" then

 回到顶部