Dim txt1 As String = e.Form.Controls("StartDate").Text
Dim txt2 As String = e.Form.Controls("EndDate").text
Dim cbx As Boolean = iif(txt1>txt2, True, False)
Dim filter As String
If cbx Then
filter = "1=2"
If txt1 <> Nothing Then
Dim sd As Date = txt1
filter &= " or 起始时间 >= #" & new Date(1900,1,1,sd.Hour,sd.Minute,sd.Second) & "#" 'Convert(起始时间,'System.String')
End If
If txt2 <> Nothing Then
Dim sd As Date = txt2
filter &= " or 起始时间 >= #" & new Date(1900,1,1,0,0,0) & "# and 起始时间 <= #" & new Date(1900,1,1,sd.Hour,sd.Minute,sd.Second) & "#" 'Convert(起始时间,'System.String')
End If
Else
filter = "1=1"
If txt1 <> Nothing Then
Dim sd As Date = txt1
filter &= " and 起始时间 >= #" & new Date(1900,1,1,sd.Hour,sd.Minute,sd.Second) & "#" 'Convert(起始时间,'System.String')
End If
If txt2 <> Nothing Then
Dim sd As Date = txt2
filter &= " and 起始时间 <= #" & new Date(1900,1,1,sd.Hour,sd.Minute,sd.Second) & "#" 'Convert(起始时间,'System.String')
End If
End If
e.Form.Controls("Table1").Table.Filter = filter