Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
合同号是根据日期来订的,比如2011年09月签的合同,合同号即为:1109*****
想通过一个时间段进行筛选。即通过输入开始时间,结束时间对合同号进行筛选。
这是我筛选代码中相关的一段:
With e.Form.Controls("Start") '开始日期的控件
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "e.row(合同号).substring(0,4) >= cstr(#" & .Value & "#).substring(2,4)"
End If
End With
With e.Form.Controls("End") '结束日期的控件'
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "e.row(合同号) <= cstr(#" & .Value & "#).substring(2,4)"
End If
End With
错误:包含未定义的函数调用 e.Row()
1、你的代码用在什么事件中,这个事件有e.row这个参数吗?
2、即使用e.row这个参数,也不是这样用的,正常的筛选,必须通过列名。
你的代码的错误有些离谱,你学了很多,但是不踏实,是跑步前进,才会写出这样的代码,建议你从头细看帮助两遍,从使用指南开始看。
正常的代码,大概是:
Dim Filter As String
With e.Form.Controls("Start") '开始日期的控件
If .Value IsNot Nothing Then
Dim s As String = .value
Filter = "Substring(合同号1,4) >= '" & s.Substring(0,4) & "'"
End If
End With
With e.Form.Controls("End") '结束日期的控件'
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Dim s As String = .value
Filter = Filter & "Substring(合同号1,4) <= '" & s.Substring(0,4) & "'"
End If
End With
Tables("XXX").Filter = Filter