添加了几个组合柜控件,想能按单个或多个条件查询,代码为以下:
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 &" = True "
End If
End With
If Filter > "" Then
Tables("订单排产_订单表").Filter = Filter
End If
报错是:
此主题相关图片如下:qq截图20130429123144.jpg

请师傅、师兄们指点