Dim Filter As String
With e.Form.Controls("单位")
If .Value IsNot Nothing Then
Filter = "单位 = '" & .Value & "'"
End If
End With
With e.Form.Controls("土地识别")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "土地识别 = '" & .Value & "'"
End If
End With
With e.Form.Controls("承包批次")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "承包批次 = '" & .Value & "'"
End If
End With
With e.Form.Controls("土地用途")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "土地用途 = '" & .Value & "'"
End If
End With
With e.Form.Controls("承包人")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "承包人 = '" & .Value & "'"
End If
End With
With e.Form.Controls("开始")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "合约结束 >= '" & .Value & "'"
End If
End With
With e.Form.Controls("截止")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "合约结束 <= '" & .Value & "'"
End If
End With
With e.Form.Controls("NumericComboBox1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "合约到期月数 >= '" & .Value & "'"
End If
End With
With e.Form.Controls("NumericComboBox2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "合约到期月数 <= '" & .Value & "'"
End If
End With
If e.Form.Controls("已确定").Checked = 1 ' 如果付款状态选择了"已付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "确定 = 1"
End If
If e.Form.Controls("未确定").Checked = 1 ' 如果付款状态选择了"未付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "确定 = 0 OR 确定 Is Null"
End If
'If Filter > "" Then
' Tables("合同管理").Filter = Filter
'End If
DataTables("合同管理").LoadFilter = Filter
DataTables("合同管理").Load