Dim Filter As String
Dim a = e.Form.Controls("TextBox1").Text
Dim b = e.Form.Controls("TextBox2").Text
With e.Form.Controls("TextBox1")
If .value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "convert(" & a & ",'System.String') Like '%" & .text & "%'"
End If
End With
With e.Form.Controls("TextBox2")
If .value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "convert(" & b & ",'System.String') Like '%" & .text & "%'"
End If
End With
With e.Form.Controls("DateTimePicker1")
If .value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "convert(工作日期,'System.DateTime') >= '#" & .text & "#'"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "convert(工作日期,'System.DateTime') <= '#" & .text & "#'"
End If
End With
If Filter > "" Then
Tables("工时").Filter = Filter
End If
这样写之后 还是出date 到decimal 转换无效