老师,还是不行啊,改成以下代码没反应。有什么问题吗?
Dim Filter As String
With e.Form.Controls("办事处")
If .Value IsNot Nothing Then
Filter = "办事处 like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("上游客户")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "上游客户 like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("任务单号")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "任务单号 like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("VIN码")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "VIN码 like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("品牌")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "品牌 like '%" & .Value & "%'"
End If
End With
If e.Form.Controls("运输").Value = "是"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "运输 = true"
End If
If e.Form.Controls("运输").Value = "否"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "运输 = false"
End If
If e.Form.Controls("有单").Value = "是"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "有单 = true"
End If
If e.Form.Controls("有单").Value = "否"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "有单 = false"
End If
With e.Form.Controls("开始")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "计划下达时间 >= #" & .Value & "#"
End If
End With
If Filter > "" Then
tables("信息总表").datatable.loadfilter = "Filter"
tables("信息总表").datatable.load
Else
tables("信息总表").datatable.loadfilter = ""
End If