首先查询用的文本框,组合框不要绑定列。
然后查询按钮
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
Tables("收入记账").Filter = Filter