Dim Filter As String
With RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("车牌号")
If .text > "" Then
Filter = "车牌号 like '%" & .text & "%'"
End If
End With
With RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("驾驶员")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "驾驶员 like '%" & .text & "%'"
End If
End With
With RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("结算单号")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "结算单号 like '%" & .text & "%'"
End If
End With
With RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("调度单号")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "调度单号 like '%" & .text & "%'"
End If
End With
With RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("结算员")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "结算员 like '%" & .text & "%'"
End If
End With
With RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("结自")
If .value <> Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "结算日期 >= '" & .value & "'"
End If
End With
With RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("结至")
If .value <> Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "结算日期 <= '" & .value & "'"
End If
End With
If RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("返单公司").text = "是" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "返单公司 = 1"
End If
If RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("返单公司").text = "否" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "返单公司 = 0"
End If
If RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("结算").text = "是"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "结算 = 1"
End If
If RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("结算").text = "否" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "结算 = 0"
End If
If RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("支付").text = "是" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "支付 = 1"
End If
If RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("支付").text = "否" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "支付 = 0"
End If
If RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("锁定").text = "是" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "锁定 = 1"
End If
If RibbonTabs("外协车辆结算").Groups("外协车辆结算").Items("锁定").text = "否" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "锁定 = 0"
End If
If Filter > "" Then
Tables("外协车辆结算").DataTable.loadfilter = Filter And "车辆类型 In ('挂靠车','外网车')"
Tables("外协车辆结算").DataTable.load
Else
Tables("外协车辆结算").DataTable.loadfilter = "车辆类型 In ('挂靠车','外网车')"
Tables("外协车辆结算").DataTable.load
End IF
以上代码当条件为空时,会正确加载。
但条件不为空时会出现错误提示:
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:菜单,查询,Click
详细错误信息:
从字符串“车牌号 like '%111%' And 结算 = 1”到类型“Long”的转换无效。
输入字符串的格式不正确。