以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  按时间段加载问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=194204)

--  作者:15666282205
--  发布时间:2024/11/19 8:42:00
--  按时间段加载问题
老师,我用下面的代码实现了按日期时间段显示,是先全部加载再筛选显示;我想实现的是不全部加载,按时间段加载。请您指导。
With DataTables("创新活动表")
.loadtop = Nothing
.loadfilter = ""
.load()
End With
Dim Filter As String

With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("DateTimePicker2")
    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


--  作者:有点蓝
--  发布时间:2024/11/19 8:58:00
--  
Dim Filter As String

With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("DateTimePicker2")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With

If Filter > "" Then
With DataTables("创新活动表")
.loadtop = Nothing
.loadfilter = Filter
.load()
End With
End If


--  作者:cd_tdh
--  发布时间:2024/11/19 8:58:00
--  
Dim Filter As String

With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("DateTimePicker2")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With
With Tables("创新活动表").DataTable
    .LoadFilter = Filter
    .Load()
End With
[此贴子已经被作者于2024/11/19 8:59:14编辑过]

--  作者:15666282205
--  发布时间:2024/11/19 10:04:00
--  
多谢两位老师,可以了