以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于日期列的年份筛选  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=88202)

--  作者:hongyefor
--  发布时间: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("开票主表").GetComboListString(Year(开票日期) ,"客户名称 = \'"& cj.text &"\'and 发票代码 = \'"& dm.text &"\'and 发票号码 = \'"& hm.text &"\'","_identify")
        Else
            e.sender.ComboList = DataTables("开票主表").GetComboListString(Year(开票日期)  ,"客户名称 = \'"& cj.text &"\'and 发票代码 = \'"& dm.text &"\'","_identify")
        End If
    Else
        If hm.SelectedItem IsNot Nothing Then
            e.sender.ComboList = DataTables("开票主表").GetComboListString(Year(开票日期) ,"客户名称 = \'"& cj.text &"\'and 发票号码 = \'"& hm.text &"\'","_identify")
        Else
            e.sender.ComboList = DataTables("开票主表").GetComboListString(Year(开票日期)  ,"客户名称 = \'"& cj.text &"\'","_identify")
        End If
    End If
Else
    If dm.SelectedItem IsNot Nothing Then
        If hm.SelectedItem IsNot Nothing Then
            e.sender.ComboList = DataTables("开票主表").GetComboListString(Year(开票日期) ," 发票代码 = \'"& dm.text &"\'and 发票号码 = \'"& hm.text &"\'","_identify")
        Else
            e.sender.ComboList = DataTables("开票主表").GetComboListString(Year(开票日期)  ," 发票代码 = \'"& dm.text &"\'","_identify")
        End If
    Else
        If hm.SelectedItem IsNot Nothing Then
            e.sender.ComboList = DataTables("开票主表").GetComboListString(Year(开票日期) ," 发票号码 = \'"& dm.text &"\'","_identify")
        Else
            e.sender.ComboList = DataTables("开票主表").GetComboListString(Year(开票日期)  ,"","_identify")
        End If
    End If
End If

 

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


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

--  作者:Hyphen
--  发布时间:2016/7/28 18:05:00
--  
不能这样用的。增加一个表达式列记录开票日期的年份


--  作者:hongyefor
--  发布时间:2016/7/28 21:01:00
--  

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


--  作者:Hyphen
--  发布时间:2016/7/29 9:30:00
--  
创建一个表达式列,表达式填:SubString(Convert([开票日期],\'System.String\'),1,4)



--  作者:hongyefor
--  发布时间: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("开票主表").Filter = "年 = \'" & kpn.Text & "\'and 发票号码 = \'" & hm.Text & "\'and 发票代码 like \'%" & dm.Text & "%\'and 客户名称 like \'%" & cj.Text & "%\'"
        Else
        Tables("开票主表").Filter = "年 = \'" & kpn.Text & "\'and 发票代码 = \'" & dm.Text & "\'and 客户名称 like \'%" & cj.Text & "%\'"
        End If
    Else
        If hm.text IsNot Nothing
        Tables("开票主表").Filter = "年 = \'" & kpn.Text & "\'and 发票号码 = \'" & hm.Text & "\'and 客户名称 like \'%" & cj.Text & "%\'"
        Else
        Tables("开票主表").Filter = "年 = \'" & kpn.Text & "\'and 客户名称 like \'%" & cj.Text & "%\'"
        End If
   End If
Else
    If dm.text IsNot Nothing
        If hm.text IsNot Nothing
        Tables("开票主表").Filter = "年 = \'" & kpn.Text & "\'and 发票号码 = \'" & hm.Text & "\'and 发票代码 like \'%" & dm.Text & "%\'"
        Else
        Tables("开票主表").Filter = "年 = \'" & kpn.Text & "\'and 发票代码 = \'" & dm.Text & "\'"
        End If
    Else
        If hm.text IsNot Nothing
        Tables("开票主表").Filter = "年 = \'" & kpn.Text & "\'and 发票号码 = \'" & hm.Text & "\'"
        Else
        Tables("开票主表").Filter = "年 = \'" & kpn.Text & "\'"
        End If
   End If
End If

 

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


--  作者:Hyphen
--  发布时间:2016/7/29 12:30:00
--  
调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm

text的判断都改成类似下面

If 控件.text > "" then