以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  代码优化问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=192505)

--  作者:lin98
--  发布时间:2024/6/27 10:56:00
--  代码优化问题
下面的代码,在多处使用或重复使用高,能不能写一个公共 地方,其他不同的表或窗口事件要使用,用类于变量或事件,调这个变量或事件,这样可以少很多代码,如何实现?
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

--  作者:有点蓝
--  发布时间:2024/6/27 10:59:00
--  
使用函数:http://www.foxtable.com/webhelp/topics/1486.htm