以下是引用狐狸爸爸在2012-8-22 16:01:00的发言:
你的筛选表达式有问题,如果搞不定,将文件传上来,我帮你检查一下。
筛选代码
Dim Filter As String
With e.Form.Controls("Combdanhao")
If .Value IsNot Nothing Then
Filter = "采购单号 = '" & .Value & "'"
End If
End With
With e.Form.Controls("Combgys")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "供应商 = '" & .Value & "'"
End If
End With
With e.Form.Controls("Combhuohao")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "货号 = '" & .Value & "'"
End If
End With
With e.Form.Controls("startdate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("enddate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Tables("采购进货.采购明细").Filter = Filter
End If